Skip to content

Commit

Permalink
moved to new node.js imports feature
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Jun 25, 2023
1 parent 898f83d commit ab06527
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 34 deletions.
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@
"engines": {
"node": ">=20.3.0"
},
"main": "index.js",
"bin": {
"qunitx": "cli.js"
},
"imports": {
"qunitx": {
"node": "./shims/nodejs.js",
"deno": "./shims/deno.js",
"default": "./index.js"
}
},
"exports": {
"node": "./shims/nodejs.js",
"deno": "./shims/deno.js",
"default": "./index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/izelnakri/qunitx.git"
Expand Down
6 changes: 6 additions & 0 deletions shims/deno.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
console.log('called');

export const module = () => {};
export const test = () => {
console.log('called test');
};
2 changes: 1 addition & 1 deletion test/commands/help-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';
import fs from 'node:fs';
import { promisify } from 'node:util';
import { exec } from 'node:child_process';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/init-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';
import assert from 'node:assert';
import { promisify } from 'node:util';
import { exec } from 'node:child_process';
Expand Down
2 changes: 1 addition & 1 deletion test/flags/after-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';
import { assertPassingTestCase, assertFailingTestCase, assertTAPResult } from '../helpers/assert-stdout.js';
import shell from '../helpers/shell.js';

Expand Down
2 changes: 1 addition & 1 deletion test/flags/before-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';
import { assertPassingTestCase, assertFailingTestCase, assertTAPResult } from '../helpers/assert-stdout.js';
import shell from '../helpers/shell.js';

Expand Down
2 changes: 1 addition & 1 deletion test/flags/coverage-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// test('todo', async (t) => {
// t.true(true);
Expand Down
2 changes: 1 addition & 1 deletion test/flags/failfast-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// test('todo', async (t) => {
// t.true(true);
Expand Down
2 changes: 1 addition & 1 deletion test/flags/output-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// test('todo', async (t) => {
// t.true(true);
Expand Down
2 changes: 1 addition & 1 deletion test/flags/reporter-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// test('todo', async (t) => {
// t.true(true);
Expand Down
2 changes: 1 addition & 1 deletion test/flags/timeout-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// test('todo', async (t) => {
// t.true(true);
Expand Down
2 changes: 1 addition & 1 deletion test/flags/watch-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// test('todo', async (t) => {
// t.true(true);
Expand Down
34 changes: 20 additions & 14 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import "./setup.js";
import { tap } from 'node:test/reporters';
import { run } from 'node:test';
// import { tap } from 'node:test/reporters';
// import { run } from 'node:test';

// run({
// concurrency: true,
// files: [
// "./test/commands/index.js",
// "./test/flags/index.js",
// "./test/inputs/index.js",
// "./test/setup/index.js",
// ],
// // timeout: 20000
// })
// .compose(tap)
// .pipe(process.stdout);

import "./commands/index.js";
import "./flags/index.js";
import "./inputs/index.js";
import "./setup/index.js";

run({
concurrency: true,
files: [
"./test/commands/index.js",
"./test/flags/index.js",
"./test/inputs/index.js",
"./test/setup/index.js",
],
// timeout: 20000
})
.compose(tap)
.pipe(process.stdout);
2 changes: 1 addition & 1 deletion test/inputs/advanced-htmls-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// runTestInsideHTMLFile

Expand Down
2 changes: 1 addition & 1 deletion test/inputs/error-edge-cases-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

// TODO: invalid extension, use --debug without browser
// folder/file doesnt exist to watch
Expand Down
2 changes: 1 addition & 1 deletion test/inputs/file-and-folder-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';

module('File and Folder Combination Tests', function() {
test('todo', async function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion test/inputs/file-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';
import { assertPassingTestCase, assertFailingTestCase, assertTAPResult } from '../helpers/assert-stdout.js';
import shell from '../helpers/shell.js';

Expand Down
2 changes: 1 addition & 1 deletion test/inputs/folder-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from '../../shims/nodejs.js';
import { module, test } from 'qunitx';
import { writeTestFolder } from '../helpers/fs-writers.js';
import { assertPassingTestCase, assertFailingTestCase, assertTAPResult } from '../helpers/assert-stdout.js';
import shell from '../helpers/shell.js';
Expand Down
7 changes: 3 additions & 4 deletions test/setup/test-file-paths-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { describe, it } from 'node:test';
import assert from 'node:assert';
import { module, test } from 'qunitx';
import setupTestFilePaths from '../../lib/setup/test-file-paths.js';

describe('Setup | glob(*) input tests | test-file-paths tests', () => {
it('setupTestFilePaths() works correctly on different inputs', () => {
module('Setup | glob(*) input tests | test-file-paths tests', () => {
test('setupTestFilePaths() works correctly on different inputs', (assert) => {
let projectRoot = '/home/izelnakri/Github/qunitx';

assert.deepEqual(setupTestFilePaths(projectRoot, [
Expand Down

0 comments on commit ab06527

Please sign in to comment.