Skip to content

Instantly share code, notes, and snippets.

@edojacobs
Last active Jul 27, 2022
Embed
What would you like to do?
/**
*
* @jest-environment jsdom
*/
import { Component } from '../dist/component';
it('test babylonjs', ()=> {
expect(new Component()).not.toBeUndefined()
})
const config = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
roots: ['./test'],
testEnvironment: 'node',
preset: 'ts-jest',
transform: {
'.(ts|js)': 'ts-jest',
'\\.[jt]sx?$': 'babel-jest',
},
moduleNameMapper: {
'/^Util/(.*)$/': './util',
'/^lib/(.*)$/': './lib',
},
moduleDirectories: ['./src', './node_modules'],
transformIgnorePatterns: ['./node_modules'],
globals: {
'ts-jest': {
isolatedModules: true,
tsConfig: 'tsconfig.dev.json',
},
},
};
export default config;
{
"scripts": {
"test": "jest --verbose",
"rollup": "rollup -c",
"build": "npm run rollup"
},
"dependencies": {
"@babylonjs/core": "^5.16.0",
"@babylonjs/loaders": "^5.16.0",
},
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-url": "^7.0.0",
"@types/jest": "^28.1.6",
"@types/node": "^18.0.4",
"babel-jest": "^28.1.3",
"jest": "^28.1.3",
"rollup": "^2.77.0",
"rollup-plugin-multi-input": "^1.3.1",
"rollup-plugin-node-externals": "^4.1.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.32.1",
"jest-environment-jsdom": "^28.1.3",
}
}
import url from '@rollup/plugin-url';
import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import multiInput from 'rollup-plugin-multi-input';
export default [
{
input: ['./src/**/*.ts'],
external: [],
output: [
{
dir: 'dist',
format: 'cjs',
sourcemap: true,
name: 'react-lib',
},
{
dir: 'dist',
format: 'esm',
sourcemap: true,
},
],
plugins: [
multiInput({ relative: 'src/' }),
typescript({
tsconfig: './tsconfig.dev.json',
}),
commonjs({
include: ['node_modules/**'],
}),
resolve({
extensions: ['.js', '.json', '.jsx', '.ts'],
}),
url(),
terser(),
],
},
];
{
"compilerOptions": {
"outDir": "dist",
"rootDir": ".",
"strict": true,
"esModuleInterop": true,
"declaration": true,
"allowJs": true,
"target": "ES2015",
"module": "ESNext",
"moduleResolution": "node",
"noResolve": false,
"noImplicitAny": false,
"sourceMap": true,
"preserveConstEnums": true,
"lib": ["dom", "es6"]
},
"include": ["src", "test", "jest.config.ts", "rollup.config.ts"],
"exclude": ["node_modules"]
}
{
"compilerOptions": {
"outDir": "build",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"declaration": true,
"allowJs": true,
"target": "es6",
"module": "CommonJS",
"moduleResolution": "node",
"noResolve": false,
"noImplicitAny": false,
"preserveConstEnums": true,
"lib": ["dom", "es6"]
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment