Skip to content

Commit 7bf844b

Browse files
committed
init test stack
1 parent 6439b8e commit 7bf844b

File tree

7 files changed

+2212
-68
lines changed

7 files changed

+2212
-68
lines changed

.github/workflows/tests.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request: ~
5+
6+
jobs:
7+
run-tests:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
12+
with:
13+
node-version: 20
14+
- run: corepack enable
15+
- run: yarn install --immutable
16+
- run: npm test

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"dev": "yarn workspace @immutable/devtools-extension run dev",
88
"build": "yarn workspaces foreach --all -pt run build",
9+
"test": "yarn workspaces foreach --all -pt run test",
910
"version": "node build/update-version.js && git add packages/extension/extension/manifest.json && git add packages/*/package.json && yarn"
1011
},
1112
"workspaces": [

packages/devtools/jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** @type {import('jest').Config} */
2+
const config = {
3+
// ignore the files named "test.js"
4+
testPathIgnorePatterns: ['<rootDir>/test.js'],
5+
};
6+
7+
export default config;

packages/devtools/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"build": "rollup -c",
1212
"prepublish": "npm run-script build",
13-
"test": "echo \"Error: no test specified\" && exit 1"
13+
"test": "jest"
1414
},
1515
"keywords": [
1616
"immutable",
@@ -22,9 +22,11 @@
2222
"devDependencies": {
2323
"@babel/core": "^7.27.1",
2424
"@babel/preset-env": "^7.27.2",
25+
"@jest/globals": "^29.7.0",
2526
"@rollup/plugin-babel": "^6.0.4",
2627
"immutable": "^5.1.2",
2728
"immutable3": "^3.8.1",
29+
"jest": "^29.7.0",
2830
"rollup": "^4.40.2"
2931
},
3032
"engines": {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { describe, test, expect } from '@jest/globals';
2+
import { List, isList } from 'immutable';
3+
import createFormatters from './createFormatters';
4+
5+
describe('List', () => {
6+
test('empty List', () => {
7+
const list = List();
8+
9+
const { ListFormatter } = createFormatters({ List, isList });
10+
11+
const formatted = ListFormatter.header(list);
12+
expect(formatted).toEqual([
13+
'span',
14+
[
15+
'span',
16+
{
17+
style:
18+
'color: light-dark(rgb(232,98,0), rgb(255, 150, 50)); position: relative',
19+
},
20+
'List',
21+
],
22+
['span', '[0]'],
23+
]);
24+
25+
expect(ListFormatter.hasBody(list)).toBe(false);
26+
});
27+
});

packages/extension/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"description": "",
66
"exports": "./index.js",
77
"scripts": {
8-
"test": "echo \"Error: no test specified\" && exit 1",
98
"build": "rollup -c",
109
"dev": "rollup -c --watch"
1110
},

0 commit comments

Comments
 (0)