Skip to content

Commit

Permalink
tests ~ revise Deno module load test(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Aug 3, 2022
1 parent 56744f1 commit a7fe4ec
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const mod = require(modulePath);
// eslint-disable-next-line security/detect-non-literal-require , security-node/detect-non-literal-require-calls
const pkg = require(packagePath);

const haveDeno = commandExists.sync('deno');

const vNodeJS = process.versions.node.split('.');
const vNodeJSMajor = +vNodeJS[0];
const vNodeJSminor = +vNodeJS[1];
Expand All @@ -47,14 +49,14 @@ test('api', (t) => {
});
});

// test examples when using `--test-dist` (ie, with version changes or prior to distribution)
// ensure *no-panic* static load for Deno
if (!process.env.npm_config_test_dist) {
test.skip('examples are executable...skipped (enable with `npm test --test-dist`)', () => void 0);
test.skip('module load test (Deno)...skipped (enable with `npm test --test-dist`)', () => void 0);
} else {
if (!commandExists.sync('deno')) {
test.skip('examples are executable (Deno)...skipped (`deno` not found)', () => void 0);
if (!haveDeno) {
test.skip('module load tests (Deno)...skipped (`deno` not found)', () => void 0);
} else {
test('module loads without panic while using `--no-prompt` (Deno)', (t) => {
test('module loads without panic (no permissions and `--no-prompt`; Deno)', (t) => {
const denoModulePath = pkg.exports['.'].deno;

const command = 'deno';
Expand All @@ -69,7 +71,16 @@ if (!process.env.npm_config_test_dist) {

t.deepEqual({ error, status }, { error: null, status: 0 });
});
}
}

// test examples when using `--test-dist` (ie, with version changes or prior to distribution)
if (!process.env.npm_config_test_dist) {
test.skip('examples are executable...skipped (enable with `npm test --test-dist`)', () => void 0);
} else {
if (!haveDeno) {
test.skip('examples are executable (Deno)...skipped (`deno` not found)', () => void 0);
} else {
test('examples are executable without error (Deno)', (t) => {
// t.timeout(30000); // 30s timeout

Expand Down

0 comments on commit a7fe4ec

Please sign in to comment.