Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Dec 22, 2023
1 parent 04f2835 commit 75232b8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
lib
dist
*.json
12 changes: 6 additions & 6 deletions test/unit_tests/testIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const mockery = require('mockery');
const child_process = require.resolve('child_process');
const nock = require('nock');

const VERSION = process.env.npm_package_version;
const {CURRENT_VERSION} = require('../../dist/utils/version.js');

function mockLogger(consoleOutput) {
mockery.registerMock(
Expand Down Expand Up @@ -32,7 +32,7 @@ describe('index tests', function() {
.get('/create-nightwatch')
.reply(200, {
'dist-tags': {
latest: VERSION
latest: CURRENT_VERSION
}
});
});
Expand Down Expand Up @@ -83,7 +83,7 @@ describe('index tests', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

const output = consoleOutput.toString();
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('index tests', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

const output = consoleOutput.toString();
Expand Down Expand Up @@ -170,12 +170,12 @@ describe('index tests', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

const output = consoleOutput.toString();
assert.strictEqual(
output.includes(`We've updated this onboarding tool: ${VERSION} -> 1.0.2. To get the latest experience, run: npm init nightwatch@latest`),
output.includes(`We've updated this onboarding tool: ${CURRENT_VERSION} -> 1.0.2.\nTo get the latest experience, run: npm init nightwatch@latest`),
true
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/testInitializeNodeProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('test initializeNodeProject', function () {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
const rootDir = 'someDirPath';
index.initializeNodeProject(rootDir);

Expand Down Expand Up @@ -100,7 +100,7 @@ describe('test initializeNodeProject', function () {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
index.initializeNodeProject(rootDir);

// Check new project created recursively
Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/testRootDir.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('test confirmRootDir', async function () {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
const rootDirPassed = 'someDirPath';
const rootDirReturned = await index.confirmRootDir(rootDirPassed);

Expand All @@ -62,7 +62,7 @@ describe('test confirmRootDir', async function () {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
const rootDirPassed = 'someDirPath';
const rootDirReturned = await index.confirmRootDir(rootDirPassed);

Expand Down
22 changes: 11 additions & 11 deletions test/unit_tests/testRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

// Check the arguments passed to NightwatchInitiator
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');

let newNodeProjectInitialized = false;
let newNodeProjectRootDir;
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');

let rootDirConfirmationPrompted = false;
index.confirmRootDir = (rootDir) => {
Expand Down Expand Up @@ -229,7 +229,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

// Check the arguments passed to NightwatchInitiator
Expand Down Expand Up @@ -267,7 +267,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');

let newNodeProjectInitialized = false;
let newNodeProjectRootDir;
Expand Down Expand Up @@ -315,7 +315,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

// Check the arguments passed to NightwatchInitiator
Expand Down Expand Up @@ -358,7 +358,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

// Check the arguments passed to NightwatchInitiator (it won't be run due to error)
Expand Down Expand Up @@ -406,7 +406,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

// Check the arguments passed to NightwatchInitiator
Expand Down Expand Up @@ -451,7 +451,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');

let newNodeProjectInitialized = false;
let newNodeProjectRootDir;
Expand Down Expand Up @@ -501,7 +501,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

// Check the arguments passed to NightwatchInitiator
Expand Down Expand Up @@ -542,7 +542,7 @@ describe('test run function', function() {
}
});

const index = require('../../lib/index');
const index = require('../../dist/index');
await index.run();

// Check the arguments passed to NightwatchInitiator
Expand Down

0 comments on commit 75232b8

Please sign in to comment.