2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 14:50:56 +00:00

test: add vitest cjs

This commit is contained in:
Joaquín Sánchez Jiménez 2022-03-04 14:52:08 +01:00
parent 9071d0aeaa
commit ad0e490b91
5 changed files with 19 additions and 14 deletions

View File

@ -1,16 +1,6 @@
/** @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} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = buildConfiguration({
moduleFileExtensions: ['ts', 'cjs', 'js'],
globals: {

View File

@ -1,6 +1,6 @@
// see https://jestjs.io/docs/ecmascript-modules
/** @type {() => typeof import('ts-jest/dist/types').InitialOptionsTsJest} */
/** @type {() => import('ts-jest/dist/types').InitialOptionsTsJest} */
/** @return {import('ts-jest/dist/types').InitialOptionsTsJest} */
const buildConfiguration = (configuration) => {
return Object.assign({}, {

View File

@ -24,7 +24,9 @@
"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",
"vitest": "vitest"
"vitest:cjs": "vitest --config vitest.config.cjs",
"vitest:esm": "vitest --config vitest.config.mjs",
"vitest": "npm run vitest:cjs && npm run vitest:esm"
},
"sideEffects": false,
"exports": {

View File

@ -0,0 +1,13 @@
const { defineConfig } = require('vitest/config');
module.exports = defineConfig({
resolve: {
mainFields: ['require'],
extensions: ['.cjs'],
},
test: {
globals: true,
watch: false,
include: ['**/tests/*-test.ts'],
},
});

View File

@ -1,4 +1,4 @@
import { defineConfig } from 'vitest/config';
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {