Skip to content

Commit

Permalink
fix: local jest no cm6, ci with cm6
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Jun 21, 2023
1 parent 0256ed7 commit 63bb04b
Show file tree
Hide file tree
Showing 6 changed files with 261 additions and 316 deletions.
4 changes: 2 additions & 2 deletions jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ module.exports = (dir, env = 'jsdom') => {
'^codemirror-graphql\\/esm([^]+)': `${__dirname}/packages/codemirror-graphql/src/$1`,
'^codemirror-graphql\\/cjs([^]+)': `${__dirname}/packages/codemirror-graphql/src/$1`,
// relies on compilation
// '^cm6-graphql\\/([^]+)': `${__dirname}/packages/cm6-graphql/src/$1`,
'^cm6-graphql\\/src\\/([^]+)': `${__dirname}/packages/cm6-graphql/dist/$1`,
'^example-([^/]+)': `${__dirname}/examples/$1/src`,
'^-!svg-react-loader.*$': '<rootDir>/resources/jest/svgImportMock.js'
},
testMatch: ['**/*[-.](spec|test).[jt]s?(x)', '!**/cypress/**'],
testEnvironment: env,
testPathIgnorePatterns: ['node_modules', 'dist', 'cypress', 'packages/cm6-graphql'],
testPathIgnorePatterns: ['node_modules', 'dist', 'cypress'],
collectCoverageFrom: ['**/src/**/*.{js,jsx,ts,tsx}'],
coveragePathIgnorePatterns: [
'dist',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"e2e:build": "yarn build && yarn workspace graphiql build-bundles-min",
"eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --max-warnings=0 --cache .",
"format": "yarn eslint --fix && yarn pretty",
"jest": "jest",
"jest": "jest --testPathIgnorePatterns cm6-graphql",
"license-check": "jsgl --local ./",
"lint": "yarn eslint && yarn lint-check && yarn pretty-check && yarn lint-cspell",
"lint-check": "eslint-config-prettier .eslintrc.js",
Expand All @@ -75,7 +75,7 @@
"start-monaco": "yarn workspace example-monaco-graphql-webpack start",
"t": "yarn run test",
"test": "yarn jest",
"test:ci": "yarn test && yarn workspace cm6-graphql test",
"test:ci": "yarn build:cm6-graphiql && jest",
"test:coverage": "yarn jest --coverage",
"test:watch": "yarn jest --watch",
"tsc": "tsc --build"
Expand All @@ -100,7 +100,7 @@
"@types/codemirror": "^0.0.90",
"@types/express": "^4.17.11",
"@types/fetch-mock": "^7.3.2",
"@types/jest": "^26.0.22",
"@types/jest": "^29.5.2",
"@types/node": "^16.18.4",
"@types/prettier": "^2.7.0",
"@types/ws": "^7.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cm6-graphql/__tests__/test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable jest/expect-expect */
import { graphqlLanguage } from '../dist';
import { graphqlLanguage } from '../dist/index.js';
import { fileTests } from '@lezer/generator/dist/test';

import * as fs from 'node:fs';
Expand Down
3 changes: 3 additions & 0 deletions packages/cm6-graphql/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const base = require('../../jest.config.base')(__dirname);

// remove the ignore line for cm6-graphql
base.testPathIgnorePatterns.pop()

module.exports = {
...base,
transformIgnorePatterns: [
Expand Down
3 changes: 1 addition & 2 deletions packages/cm6-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "GraphQL language support for CodeMirror 6",
"scripts": {
"build": "cm-buildhelper src/index.ts",
"prepare": "yarn build",
"test": "yarn build && yarn test"
"prepare": "yarn build"
},
"main": "dist/index.cjs",
"module": "dist/index.js",
Expand Down
Loading

0 comments on commit 63bb04b

Please sign in to comment.