Skip to content

Commit

Permalink
fix(testing): add testing sub module to export map (#5873)
Browse files Browse the repository at this point in the history
* fix(testing): add testing sub module to export map

* add require import for ./internal/client
  • Loading branch information
christian-bromann authored Jul 1, 2024
1 parent dfbc340 commit bb2e04f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
"types": "./internal/index.d.ts"
},
"./internal/client": {
"import": "./internal/client/index.js"
"import": "./internal/client/index.js",
"require": "./internal/client/index.js"
},
"./internal/testing": {
"import": "./internal/testing/index.js"
"import": "./internal/testing/index.js",
"require": "./internal/testing/index.js"
},
"./internal/testing/*": {
"import": "./internal/testing/*"
Expand All @@ -61,7 +63,8 @@
"types": "./compiler/stencil.d.ts"
},
"./compiler/*": {
"import": "./compiler/*"
"import": "./compiler/*",
"types": "./compiler/*"
},
"./sys/node": {
"import": "./sys/node/index.js",
Expand All @@ -71,6 +74,15 @@
"./sys/node/*": {
"import": "./sys/node/*",
"require": "./sys/node/*"
},
"./testing": {
"import": "./testing/index.js",
"types": "./testing/index.d.ts",
"require": "./testing/index.js"
},
"./testing/*": {
"import": "./testing/*",
"require": "./testing/*"
}
},
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions test/end-to-end/exportMap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ const { h } = require('@stencil/core');
const { MockDocument } = require('@stencil/core/mock-doc');
const appData = require('@stencil/core/internal/app-data');
const { createNodeLogger } = require('@stencil/core/sys/node');
const { createTesting } = require('@stencil/core/testing');

assert(typeof version === 'string');
assert(typeof run, 'function');
assert(typeof h === 'function');
assert(typeof MockDocument === 'function');
assert(Object.keys(appData).length === 3);
assert(typeof createNodeLogger === 'function');
assert(typeof createTesting === 'function');

console.log(`🎉 All CJS imports successfully resolved!`);
console.log('✅ passed!\n');
31 changes: 18 additions & 13 deletions test/end-to-end/exportMap/index.mts
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import assert from 'node:assert'
import assert from 'node:assert';

import { run } from '@stencil/core/cli'
import { version } from '@stencil/core/compiler'
import { run } from '@stencil/core/cli';
import { version } from '@stencil/core/compiler';
import { MockDocument } from '@stencil/core/mock-doc';
import type { BuildConditionals } from '@stencil/core/internal';
import { BUILD } from '@stencil/core/internal/app-data'
import { createNodeLogger } from '@stencil/core/sys/node'
import { BUILD } from '@stencil/core/internal/app-data';
import { createNodeLogger } from '@stencil/core/sys/node';
import { createTesting } from '@stencil/core/testing';

assert(typeof version === 'string')
version.slice()
BUILD as BuildConditionals
assert(typeof version === 'string');
version.slice();
BUILD as BuildConditionals;

assert(typeof run, 'function')
run.call
assert(typeof run, 'function');
run.call;

assert(typeof MockDocument === 'function')
assert(typeof BUILD !== 'undefined')
assert(typeof createNodeLogger === 'function')
assert(typeof MockDocument === 'function');
assert(typeof BUILD !== 'undefined');
assert(typeof createNodeLogger === 'function');
assert(typeof createTesting === 'function');

console.log(`🎉 All ESM imports successfully resolved!`);
console.log('✅ passed!\n');

0 comments on commit bb2e04f

Please sign in to comment.