From 21e9736c81faa47e654cf152320cfb40af03949a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 4 Dec 2021 21:11:52 +0200 Subject: [PATCH] chore(putout) declare-undefined-variables: add custom declaration of stopAll --- .putout.json | 7 +++++++ server/route.spec.js | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.putout.json b/.putout.json index b7d0e6c8..e2d41123 100644 --- a/.putout.json +++ b/.putout.json @@ -1,4 +1,11 @@ { + "rules": { + "declare-undefined-variables": ["on", { + "declarations": { + "stopAll": "const {stopAll} = mockRequire" + } + }] + }, "ignore": [ "html", "fixture*", diff --git a/server/route.spec.js b/server/route.spec.js index d8cd91bb..8685132e 100644 --- a/server/route.spec.js +++ b/server/route.spec.js @@ -8,7 +8,10 @@ const fs = require('fs'); const tryToCatch = require('try-to-catch'); const {test, stub} = require('supertape'); const mockRequire = require('mock-require'); -const {reRequire, stopAll} = mockRequire; +const { + reRequire, + stopAll, +} = mockRequire; const fixtureDir = path.join(__dirname, '..', 'test', 'fixture'); @@ -481,14 +484,14 @@ test('cloudcmd: route: read: root', async (t) => { await request.get('/fs/route.js'); - stopAll(); - const expected = [ '/hello/route.js', { root, }, ]; + stopAll(); + t.calledWith(read, expected); t.end(); });