Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node test github workflow #34

Merged
merged 13 commits into from
Apr 2, 2024
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
###############################################################################
* text=auto

lib/**/* text eol=lf
test/**/* text eol=lf

# Declare files that will always have CRLF line endings on checkout.
src/automationttsengine/**/* text eol=crlf
src/makevoice/**/* text eol=crlf
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Node.js CI

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [windows-2022]
node-version: ['18.x']
test-command:
- npm run test-style
- npm run test-types
- npm run test-unit

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: ${{ matrix.test-command }}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
},
"scripts": {
"prettier": "prettier --write lib test",
"test": "prettier --check lib test && npm run test-types && npm run test-unit",
"test-unit": "mocha --ui tdd test/**/*.js",
"test-types": "tsc -p tsconfig.json"
"test": "npm run test-style && npm run test-types && npm run test-unit",
"test-style": "prettier --check lib test",
"test-types": "tsc -p tsconfig.json",
"test-unit": "mocha --ui tdd test/**/*.js"
},
"files": [
"lib",
Expand Down
8 changes: 8 additions & 0 deletions test/helpers/macos/applescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ const {
} = require('../../../lib/helpers/macos/applescript.js');
const { parseCodePoints } = require('../../../lib/helpers/macos/parseCodePoints.js');
const { keyCodeCommand } = require('../../../lib/helpers/macos/keyCodeCommand.js');
const IS_MACOS = require('os').platform() === 'darwin';

suite('helpers/macos/applescript', () => {
suiteSetup(function () {
if (!IS_MACOS) {
this.skip();
return;
}
});

suite('parseCodePoints', () => {
test('space', () => {
assert.deepEqual(parseCodePoints([' ']), keyCodeCommand(['space'], []));
Expand Down
Loading