diff --git a/zora/package.json b/zora/package.json index 2d211f0..691af3e 100644 --- a/zora/package.json +++ b/zora/package.json @@ -18,23 +18,20 @@ "mocha" ], "type": "module", + "main": "./dist/index.cjs", "exports": { "./package.json": "./package.json", ".": { "import": { - "types": "./dist/zora.d.ts", - "default": "./es.js" + "types": "./dist/index.d.ts", + "default": "./dist/index.js" }, "require": { - "types": "./dist/zora.d.ts", + "types": "./dist/index.d.cts", "default": "./dist/index.cjs" } - }, - "./cjs": "./dist/index.cjs", - "./es": "./dist/index.js" + } }, - "types": "dist/zora.d.ts", - "main": "./dist/index.cjs", "prettier": { "singleQuote": true }, @@ -49,8 +46,7 @@ "zora-assert": "*" }, "files": [ - "dist", - "es.js" + "dist" ], "author": "@lorenzofox3 ", "license": "MIT", diff --git a/zora/rollup-types.js b/zora/rollup-types.js index 062af32..7fd973a 100644 --- a/zora/rollup-types.js +++ b/zora/rollup-types.js @@ -2,9 +2,12 @@ import dts from 'rollup-plugin-dts'; export default { input: 'src/types/index.d.ts', - output: { - file: 'dist/zora.d.ts', + output: [{ + file: 'dist/index.d.ts', format: 'es', - }, + },{ + file: 'dist/index.d.cts', + format: 'cjs', + }], plugins: [dts()], }; diff --git a/zora/test/run.js b/zora/test/run.js index b817b70..65a3b5d 100644 --- a/zora/test/run.js +++ b/zora/test/run.js @@ -3,7 +3,7 @@ import { resolve, extname } from 'node:path'; import { readFile } from 'node:fs/promises'; import { readdirSync } from 'node:fs'; import { execPath as node } from 'node:process'; -import { test } from 'zora'; +import { test } from '../src/index.js'; const ONLY_ERROR = ['no_only_mode.js', 'no_only_mode_nested.js']; const sampleRoot = resolve(process.cwd(), './test/samples/'); diff --git a/zora/test/samples/async.js b/zora/test/samples/async.js index 8cbd4c6..0482ac5 100644 --- a/zora/test/samples/async.js +++ b/zora/test/samples/async.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; const wait = (time) => new Promise((resolve) => { diff --git a/zora/test/samples/bailout.js b/zora/test/samples/bailout.js index 8a005a6..38f10e6 100644 --- a/zora/test/samples/bailout.js +++ b/zora/test/samples/bailout.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('will not go to the end', (t) => { t.ok(true, 'okay'); diff --git a/zora/test/samples/bailout_nested.js b/zora/test/samples/bailout_nested.js index 1bf220e..9ed1250 100644 --- a/zora/test/samples/bailout_nested.js +++ b/zora/test/samples/bailout_nested.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('will not go to the end', (t) => { t.ok(true, 'okay'); diff --git a/zora/test/samples/circular_ref_obj.js b/zora/test/samples/circular_ref_obj.js index 1c37802..5cdc0b3 100644 --- a/zora/test/samples/circular_ref_obj.js +++ b/zora/test/samples/circular_ref_obj.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('circular ref in diagnostic', (t) => { const b = { key: 'prop' }; diff --git a/zora/test/samples/custom_assertion.js b/zora/test/samples/custom_assertion.js index 2881a93..8ffee64 100644 --- a/zora/test/samples/custom_assertion.js +++ b/zora/test/samples/custom_assertion.js @@ -1,4 +1,4 @@ -import { Assert, test } from 'zora'; +import { Assert, test } from '../../src/index.js'; Assert.isFoo = (value, description = 'should be "foo"') => ({ pass: value === 'foo', @@ -6,7 +6,7 @@ Assert.isFoo = (value, description = 'should be "foo"') => ({ actual: value, operator: 'isFoo', description, - other: 'property', + other: 'property' }); test('tester 1', (t) => { diff --git a/zora/test/samples/failing.js b/zora/test/samples/failing.js index 649038a..6d90aa0 100644 --- a/zora/test/samples/failing.js +++ b/zora/test/samples/failing.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('tester 1', (t) => { t.ok(true, 'assert1'); diff --git a/zora/test/samples/failing_nested.js b/zora/test/samples/failing_nested.js index e946079..f326432 100644 --- a/zora/test/samples/failing_nested.js +++ b/zora/test/samples/failing_nested.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('tester 1', (t) => { t.ok(true, 'assert1'); diff --git a/zora/test/samples/flush.js b/zora/test/samples/flush.js index cbdc226..19c9e7b 100644 --- a/zora/test/samples/flush.js +++ b/zora/test/samples/flush.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; const wait = (time) => new Promise((resolve) => { diff --git a/zora/test/samples/late_collect.js b/zora/test/samples/late_collect.js index d6e2f7b..3c17df4 100644 --- a/zora/test/samples/late_collect.js +++ b/zora/test/samples/late_collect.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test(`late collection`, async (t) => { t.ok(true); diff --git a/zora/test/samples/nested.js b/zora/test/samples/nested.js index 2af0bd3..28b2af1 100644 --- a/zora/test/samples/nested.js +++ b/zora/test/samples/nested.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('tester 1', (t) => { t.ok(true, 'assert1'); diff --git a/zora/test/samples/nested_async.js b/zora/test/samples/nested_async.js index 45eb67e..7e1d81d 100644 --- a/zora/test/samples/nested_async.js +++ b/zora/test/samples/nested_async.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; const wait = (time) => new Promise((resolve) => { diff --git a/zora/test/samples/no_only_mode.js b/zora/test/samples/no_only_mode.js index cc9c607..abe9d86 100644 --- a/zora/test/samples/no_only_mode.js +++ b/zora/test/samples/no_only_mode.js @@ -1,4 +1,4 @@ -import { test, only } from 'zora'; +import { test, only } from '../../src/index.js'; test('should not run', (t) => { t.fail('I should not run '); diff --git a/zora/test/samples/no_only_mode_nested.js b/zora/test/samples/no_only_mode_nested.js index 2fb4fe5..c17a452 100644 --- a/zora/test/samples/no_only_mode_nested.js +++ b/zora/test/samples/no_only_mode_nested.js @@ -1,4 +1,4 @@ -import { test, only } from 'zora'; +import { test, only } from '../../src/index.js'; test('should not run', (t) => { t.fail('I should not run '); diff --git a/zora/test/samples/only.js b/zora/test/samples/only.js index 57217c2..b25d132 100644 --- a/zora/test/samples/only.js +++ b/zora/test/samples/only.js @@ -1,4 +1,4 @@ -import { only, test } from 'zora'; +import { only, test } from '../../src/index.js'; test('should not run', (t) => { t.fail('I should not run '); diff --git a/zora/test/samples/only_nested.js b/zora/test/samples/only_nested.js index 7028b76..f705802 100644 --- a/zora/test/samples/only_nested.js +++ b/zora/test/samples/only_nested.js @@ -1,4 +1,4 @@ -import { only, test } from 'zora'; +import { only, test } from '../../src/index.js'; test('should not run', (t) => { t.fail('I should not run '); diff --git a/zora/test/samples/simple.js b/zora/test/samples/simple.js index 04660fe..f6baaef 100644 --- a/zora/test/samples/simple.js +++ b/zora/test/samples/simple.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('tester 1', (t) => { t.ok(true, 'assert1'); diff --git a/zora/test/samples/skip.js b/zora/test/samples/skip.js index 5114caf..2848a19 100644 --- a/zora/test/samples/skip.js +++ b/zora/test/samples/skip.js @@ -1,4 +1,4 @@ -import { test, skip } from 'zora'; +import { test, skip } from '../../src/index.js'; test('hello world', (t) => { t.ok(true); diff --git a/zora/test/samples/symbol.js b/zora/test/samples/symbol.js index bfb3150..0a0f70c 100644 --- a/zora/test/samples/symbol.js +++ b/zora/test/samples/symbol.js @@ -1,4 +1,4 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; test('symbol tester 1', (t) => { t.equal(Symbol('foo'), Symbol('bar'), 'Symbol foo should equal Symbol bar'); diff --git a/zora/test/samples/timeout.js b/zora/test/samples/timeout.js index 53ae599..b379977 100644 --- a/zora/test/samples/timeout.js +++ b/zora/test/samples/timeout.js @@ -1,10 +1,11 @@ -import { test } from 'zora'; +import { test } from '../../src/index.js'; import { setTimeout } from 'node:timers/promises'; test( 'broken promise', ({ ok }) => { - return new Promise(() => {}).then(() => { + return new Promise(() => { + }).then(() => { ok(true); }); }, @@ -15,7 +16,8 @@ test('timeout in a nested test', ({ test }) => { test( 'nested', ({ ok }) => { - return new Promise(() => {}).then(() => { + return new Promise(() => { + }).then(() => { ok(true); }); },