mirror of
https://github.com/iconify/iconify.git
synced 2024-12-13 22:18:24 +00:00
chore: add type module again, jest tests working again
This commit is contained in:
parent
ae3706cbf8
commit
dec6e45770
@ -40,6 +40,10 @@ export default defineBuildConfig({
|
|||||||
],
|
],
|
||||||
clean: true,
|
clean: true,
|
||||||
declaration: true,
|
declaration: true,
|
||||||
|
externals: [
|
||||||
|
'local-pkg',
|
||||||
|
'fs',
|
||||||
|
],
|
||||||
rollup: {
|
rollup: {
|
||||||
emitCJS: true,
|
emitCJS: true,
|
||||||
},
|
},
|
||||||
|
21
packages/utils/jest.config.cjs
Normal file
21
packages/utils/jest.config.cjs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||||
|
/*
|
||||||
|
module.exports = {
|
||||||
|
verbose: true,
|
||||||
|
preset: 'ts-jest',
|
||||||
|
testEnvironment: 'node',
|
||||||
|
testMatch: ['**!/tests/!*-test.ts'],
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { buildConfiguration } = require('./jest.shared.config.cjs');
|
||||||
|
|
||||||
|
/** @type {() => typeof import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||||
|
module.exports = buildConfiguration({
|
||||||
|
moduleFileExtensions: ['ts', 'cjs', 'js'],
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
useESM: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
10
packages/utils/jest.config.mjs
Normal file
10
packages/utils/jest.config.mjs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import pkg from './jest.shared.config.cjs';
|
||||||
|
|
||||||
|
export default pkg.buildConfiguration({
|
||||||
|
moduleFileExtensions: ['ts', 'mjs', 'js'],
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
useESM: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
@ -1,8 +1,8 @@
|
|||||||
import type { Config } from '@jest/types'
|
|
||||||
|
|
||||||
// see https://jestjs.io/docs/ecmascript-modules
|
// see https://jestjs.io/docs/ecmascript-modules
|
||||||
|
|
||||||
export const buildConfiguration = (configuration: Partial<Config.InitialOptions>): Config.InitialOptions => {
|
/** @type {() => typeof import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||||
|
/** @return {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||||
|
const buildConfiguration = (configuration) => {
|
||||||
return Object.assign({}, {
|
return Object.assign({}, {
|
||||||
verbose: true,
|
verbose: true,
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
@ -19,3 +19,6 @@ export const buildConfiguration = (configuration: Partial<Config.InitialOptions>
|
|||||||
],
|
],
|
||||||
}, configuration)
|
}, configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.buildConfiguration = buildConfiguration;
|
||||||
|
module.exports = { buildConfiguration };
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@iconify/utils",
|
"name": "@iconify/utils",
|
||||||
|
"type": "module",
|
||||||
"description": "Common functions for working with Iconify icon sets used by various packages.",
|
"description": "Common functions for working with Iconify icon sets used by various packages.",
|
||||||
"author": "Vjacheslav Trushkin",
|
"author": "Vjacheslav Trushkin",
|
||||||
"version": "1.0.23",
|
"version": "1.0.23",
|
||||||
@ -20,8 +21,8 @@
|
|||||||
"test:jest": "jest --runInBand",
|
"test:jest": "jest --runInBand",
|
||||||
"test:jasmine": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jasmine",
|
"test:jasmine": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jasmine",
|
||||||
"test": "npm run test:jest && npm run test:jasmine",
|
"test": "npm run test:jest && npm run test:jasmine",
|
||||||
"test:jest-esm": "npm run build-dual && jest --clearCache && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest --config=jest.esm.config.ts",
|
"test:jest-cjs": "npm run build-dual && jest --clearCache && jest --config=jest.config.cjs",
|
||||||
"test:jest-cjs": "npm run build-dual && jest --clearCache && jest --config=jest.cjs.config.ts",
|
"test:jest-esm": "npm run build-dual && jest --clearCache && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest --config=jest.config.mjs",
|
||||||
"test-dual": "npm run test:jest-esm && npm run test:jest-cjs && npm run test:jasmine"
|
"test-dual": "npm run test:jest-esm && npm run test:jest-cjs && npm run test:jasmine"
|
||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
@ -30,6 +31,7 @@
|
|||||||
"require": "./lib/index.cjs",
|
"require": "./lib/index.cjs",
|
||||||
"import": "./lib/index.mjs"
|
"import": "./lib/index.mjs"
|
||||||
},
|
},
|
||||||
|
"./*": "./*",
|
||||||
"./lib/colors": {
|
"./lib/colors": {
|
||||||
"require": "./lib/colors/index.cjs",
|
"require": "./lib/colors/index.cjs",
|
||||||
"import": "./lib/colors/index.mjs"
|
"import": "./lib/colors/index.mjs"
|
||||||
@ -186,21 +188,13 @@
|
|||||||
"./lib/svg/size": {
|
"./lib/svg/size": {
|
||||||
"require": "./lib/svg/size.cjs",
|
"require": "./lib/svg/size.cjs",
|
||||||
"import": "./lib/svg/size.mjs"
|
"import": "./lib/svg/size.mjs"
|
||||||
},
|
}
|
||||||
"./*": "./*"
|
|
||||||
},
|
},
|
||||||
"main": "lib/index.cjs",
|
"main": "lib/index.cjs",
|
||||||
"module": "lib/index.mjs",
|
"module": "lib/index.mjs",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
"lib/colors",
|
|
||||||
"lib/customisations",
|
|
||||||
"lib/icon",
|
|
||||||
"lib/icon-set",
|
|
||||||
"lib/loader",
|
|
||||||
"lib/misc",
|
|
||||||
"lib/svg",
|
|
||||||
"*.d.ts"
|
"*.d.ts"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Loading…
Reference in New Issue
Block a user