Skip to content

Commit a113128

Browse files
CATISNOTSODIUMCATISNOTSODIUM
authored andcommitted
Merge remote-tracking branch 'origin/master' into stepper/rewrite
2 parents 11514d6 + 45fdca2 commit a113128

File tree

94 files changed

+6983
-10597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6983
-10597
lines changed

.github/workflows/build-development.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on:
33
push:
44
branches:
55
- master
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
description: Branch/Tag/SHA to checkout
10+
required: true
11+
default: master
612

713
jobs:
814
deploy:
@@ -11,6 +17,8 @@ jobs:
1117
steps:
1218
- name: Checkout repository
1319
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.event.inputs.ref }}
1422
# Has to be run before actions/setup-node.
1523
# See: https://github.com/actions/setup-node/issues/480
1624
- name: Enable corepack for Yarn

craco.config.js

Lines changed: 0 additions & 182 deletions
This file was deleted.

jest.config.js

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// @ts-check
2+
3+
const ignoreModulePaths = (...paths) => {
4+
const moduleRoot = replaceSlashes('/node_modules/');
5+
const modulePaths = paths
6+
.map(replaceSlashes)
7+
.map(path => `(${path}[/\\\\.*])`)
8+
.join('|');
9+
return moduleRoot + '(?!' + modulePaths + ').*.(js|jsx|ts|tsx)$';
10+
};
11+
const replaceSlashes = target => {
12+
return target.replaceAll('/', '[/\\\\]');
13+
};
14+
15+
/** @type {import('jest').Config} */
16+
export default {
17+
moduleDirectories: ['<rootDir>', 'node_modules'],
18+
testEnvironment: './jsdom-env.js',
19+
transform: {
20+
'^.+\\.(t|j)sx?$': [
21+
'@swc/jest',
22+
{
23+
sourceMaps: true,
24+
jsc: {
25+
parser: {
26+
syntax: 'typescript',
27+
tsx: true,
28+
decorators: false,
29+
dynamicImport: false
30+
},
31+
baseUrl: '.',
32+
transform: {
33+
react: {
34+
runtime: 'automatic'
35+
}
36+
}
37+
}
38+
}
39+
]
40+
},
41+
transformIgnorePatterns: [
42+
// Will give something like
43+
// '[/\\\\]node_modules[/\\\\]
44+
// (?!
45+
// ( @ion-phaser[/\\\\]react[/\\\\.*] )|
46+
// ( js-slang[/\\\\.*] )|
47+
// ( array-move[/\\\\.*] )|
48+
// ...
49+
// ( comma-separated-tokens[/\\\\.*] )
50+
// ).*.(js|jsx|ts|tsx)$'
51+
ignoreModulePaths(
52+
'@ion-phaser/react',
53+
'js-slang',
54+
'array-move',
55+
'konva',
56+
'react-konva',
57+
'react-debounce-render',
58+
'devlop',
59+
'hastscript',
60+
'hast-to-hyperscript',
61+
'hast-util-.+',
62+
'mdast-util-.+',
63+
'micromark',
64+
'micromark-.+',
65+
'vfile',
66+
'vfile-message',
67+
'unist-util-.+',
68+
'web-namespaces',
69+
'rehype-react',
70+
'unified',
71+
'bail',
72+
'is-plain-obj',
73+
'trough',
74+
'decode-named-character-reference',
75+
'character-entities',
76+
'trim-lines',
77+
'property-information',
78+
'space-separated-tokens',
79+
'comma-separated-tokens',
80+
'query-string',
81+
'decode-uri-component',
82+
'split-on-first',
83+
'filter-obj',
84+
'@sourceacademy/c-slang',
85+
'java-parser',
86+
'conductor'
87+
),
88+
'^.+\\.module\\.(css|sass|scss)$'
89+
],
90+
moduleNameMapper: {
91+
'\\.(jpg|jpeg)$': '<rootDir>/src/fileMock.ts',
92+
'\\.svg$': 'identity-obj-proxy',
93+
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
94+
'unist-util-visit-parents/do-not-use-color':
95+
'<rootDir>/node_modules/unist-util-visit-parents/lib',
96+
'vfile/do-not-use-conditional-minpath': '<rootDir>/node_modules/vfile/lib',
97+
'vfile/do-not-use-conditional-minproc': '<rootDir>/node_modules/vfile/lib',
98+
'vfile/do-not-use-conditional-minurl': '<rootDir>/node_modules/vfile/lib'
99+
},
100+
setupFilesAfterEnv: [
101+
'./src/setupTests.ts', // Setup file for Jest
102+
'./src/i18n/i18n.ts' // Setup i18next configuration
103+
]
104+
};

jsdom-env.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestEnvironment as JSDOMEnvironment } from 'jest-environment-jsdom';
2+
3+
// https://stackoverflow.com/a/78051351
4+
export default class FixJSDOMEnvironment extends JSDOMEnvironment {
5+
constructor(...args) {
6+
super(...args);
7+
this.global.fetch = fetch;
8+
this.global.Request = Request;
9+
this.global.Response = Response;
10+
// And any other missing globals
11+
}
12+
}
13+
14+
// https://github.com/prisma/prisma/discussions/14504#discussioncomment-3406588
15+
// https://jest-archive-august-2023.netlify.app/docs/28.x/upgrading-to-jest28#custom-environment
16+
export const TestEnvironment = FixJSDOMEnvironment;

0 commit comments

Comments
 (0)