Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avivkeller committed Apr 14, 2024
1 parent 122298b commit ac04940
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/fixtures/main-runner-order/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
console.log("./app.js")
module.exports = "./app.js"
2 changes: 2 additions & 0 deletions test/fixtures/main-runner-order/app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
console.log("./app/index.js")
module.exports = "./app/index.js"
23 changes: 23 additions & 0 deletions test/fixtures/main-runner-order/app/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

require('../../../common');
const assert = require('assert');
const child_process = require('child_process');

async function spawnNodeRunner(path) {
return new Promise((resolve, reject) => {
child_process.exec(`node ${path}`, (err, stdout, stderr) => {
if (err) {
reject(err);
} else {
resolve(stdout);
}
});
});
};

async function main() {
assert.strictEqual((await spawnNodeRunner('.')).trim(), require('.').trim());
}

main();

0 comments on commit ac04940

Please sign in to comment.