Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": "eslint:recommended",
"globals": {
"module": "readonly",
"require": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"requireConfigFile": false,
"sourceType": "module"
},
"ignorePatterns": ["**min.js", "**/highlight.js", "**/playground_editor/*"],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"brace-style": [
"error",
"1tbs",
{ "allowSingleLine": false }
],
"curly": "error",
"no-trailing-spaces": "error",
"no-multi-spaces": "error",
"keyword-spacing": [
"error",
{ "before": true, "after": true }
],
"comma-spacing": [
"error",
{ "before": false, "after": true }
],
"arrow-spacing": [
"error",
{ "before": true, "after": true }
],
"key-spacing": [
"error",
{ "beforeColon": false, "afterColon": true, "mode": "strict" }
],
"func-call-spacing": ["error", "never"],
"space-infix-ops": "error",
"space-before-function-paren": ["error", "never"],
"space-before-blocks": "error",
"no-console": [
"error",
{ "allow": ["warn", "error"] }
],
"comma-dangle": ["error", "always-multiline"],
"comma-style": ["error", "last"],
"max-len": ["error", { "code": 100, "tabWidth": 2 }],
"eol-last": ["error", "always"],
"no-extra-parens": "error",
"arrow-parens": ["error", "as-needed"],
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"prefer-const": ["error"],
"no-var": "error",
"eqeqeq": "error"
},
"overrides": [
{
"files": [
"tests/**/*.js"
],
"env": {
"jest": true,
"node": true
}
}
]
}
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ on:
pull_request:
merge_group:

env:
BROWSER_UI_TEST_VERSION: '0.19.0'

jobs:
test:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -85,7 +82,9 @@ jobs:
with:
node-version: 20
- name: Install browser-ui-test
run: npm install browser-ui-test@"${BROWSER_UI_TEST_VERSION}"
run: npm install
- name: Run eslint
run: npm run lint
- name: Build and run tests (+ GUI)
run: cargo test --locked --target x86_64-unknown-linux-gnu --test gui

Expand Down
18 changes: 17 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ If you want to only run some tests, you can filter them by passing (part of) the
cargo test --test gui -- search
```

The first time, it'll fail and ask you to install the `browser-ui-test` package. Install it then re-run the tests.
The first time, it'll fail and ask you to install the `browser-ui-test` package. Install it with the provided
command then re-run the tests.

If you want to disable the headless mode, use the `--disable-headless-test` option:

Expand All @@ -162,6 +163,21 @@ The GUI tests are in the directory `tests/gui` in text files with the `.goml` ex
using a `node.js` framework called `browser-ui-test`. You can find documentation for this language on its
[repository](https://github.com/GuillaumeGomez/browser-UI-test/blob/master/goml-script.md).

### Checking changes in `.js` files

The `.js` files source code is checked using [`eslint`](https://eslint.org/). This is a linter (just like `clippy` in Rust)
for the Javascript language. You can install it with `npm` by running the following command:

```
npm install
```

Then you can run it using:

```
npm run lint
```

## Updating highlight.js

The following are instructions for updating [highlight.js](https://highlightjs.org/).
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dependencies": {
"browser-ui-test": "0.19.0",
"eslint": "^8.57.1"
},
"scripts": {
"lint": "eslint src/theme/*js src/theme/**/*js",
"lint-fix": "eslint --fix src/theme/*js src/theme/**/*js"
}
}
Loading