mirror of
https://github.com/iconify/iconify.git
synced 2024-12-13 14:13:06 +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,
|
||||
declaration: true,
|
||||
externals: [
|
||||
'local-pkg',
|
||||
'fs',
|
||||
],
|
||||
rollup: {
|
||||
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
|
||||
|
||||
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({}, {
|
||||
verbose: true,
|
||||
testEnvironment: 'node',
|
||||
@ -19,3 +19,6 @@ export const buildConfiguration = (configuration: Partial<Config.InitialOptions>
|
||||
],
|
||||
}, configuration)
|
||||
}
|
||||
|
||||
exports.buildConfiguration = buildConfiguration;
|
||||
module.exports = { buildConfiguration };
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "@iconify/utils",
|
||||
"type": "module",
|
||||
"description": "Common functions for working with Iconify icon sets used by various packages.",
|
||||
"author": "Vjacheslav Trushkin",
|
||||
"version": "1.0.23",
|
||||
@ -20,8 +21,8 @@
|
||||
"test:jest": "jest --runInBand",
|
||||
"test:jasmine": "cross-env NODE_OPTIONS=--experimental-vm-modules npx 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.cjs.config.ts",
|
||||
"test:jest-cjs": "npm run build-dual && jest --clearCache && jest --config=jest.config.cjs",
|
||||
"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"
|
||||
},
|
||||
"sideEffects": false,
|
||||
@ -30,6 +31,7 @@
|
||||
"require": "./lib/index.cjs",
|
||||
"import": "./lib/index.mjs"
|
||||
},
|
||||
"./*": "./*",
|
||||
"./lib/colors": {
|
||||
"require": "./lib/colors/index.cjs",
|
||||
"import": "./lib/colors/index.mjs"
|
||||
@ -186,22 +188,14 @@
|
||||
"./lib/svg/size": {
|
||||
"require": "./lib/svg/size.cjs",
|
||||
"import": "./lib/svg/size.mjs"
|
||||
},
|
||||
"./*": "./*"
|
||||
}
|
||||
},
|
||||
"main": "lib/index.cjs",
|
||||
"module": "lib/index.mjs",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib",
|
||||
"lib/colors",
|
||||
"lib/customisations",
|
||||
"lib/icon",
|
||||
"lib/icon-set",
|
||||
"lib/loader",
|
||||
"lib/misc",
|
||||
"lib/svg",
|
||||
"*.d.ts"
|
||||
"*.d.ts"
|
||||
],
|
||||
"dependencies": {
|
||||
"@antfu/install-pkg": "^0.1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user