Skip to content

Commit

Permalink
Fix run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed May 10, 2023
1 parent 1e2acfb commit 4539bb9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
cwd := $(dir $(mkfile_path))
build ?= build
build ?= es2015
devMode ?= development
generateTypes ?= generateTypes
es ?= es2015
Expand All @@ -19,7 +19,7 @@ WEBPACK_DEV_PORT := 2000
NODE_MODULES_BIN := ./node_modules/.bin
TS_NODE_BASE := $(NODE_MODULES_BIN)/ts-node --project $(cwd)tools/tsconfig.json
WEBPACK := $(TS_NODE_BASE) $(NODE_MODULES_BIN)/webpack
KARMA := $(TS_NODE_BASE) $(NODE_MODULES_BIN)/karma start
KARMA := @TS_NODE_TRANSPILE_ONLY=true $(TS_NODE_BASE) $(NODE_MODULES_BIN)/karma start

.PHONY: version
version:
Expand Down Expand Up @@ -142,7 +142,7 @@ test-find:

.PHONY: test-only-run
test-only-run:
$(KARMA) --browsers $(browsers) ./test/karma.conf.ts --single-run $(singleRun) --build=$(build) --min=$(uglify)
$(KARMA) --browsers $(browsers) $(cwd)tools/karma.conf.ts --single-run $(singleRun) --build=$(build) --min=$(uglify) --cwd=$(cwd)

.PHONY: coverage
coverage:
Expand Down
15 changes: 11 additions & 4 deletions test/karma.conf.ts → tools/karma.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
import type { Config } from 'karma';
import * as yargs from 'yargs';
import * as fs from 'fs';
import path from 'path';

const argv = yargs
.option('grep', {
type: 'string',
description: 'Grep test glob pattern'
})
.option('cwd', {
type: 'string',
demandOption: true,
description: 'Work directory'
})
.option('build', {
type: 'string',
demandOption: true,
Expand All @@ -31,12 +37,13 @@ if (argv.grep) {

const buildDir = './build/' + argv.build;

const workDirectory = path.resolve(argv.cwd, buildDir);

if (
!argv.build ||
!fs.existsSync(buildDir) ||
!fs.statSync(buildDir).isDirectory()
!fs.existsSync(workDirectory) ||
!fs.statSync(workDirectory).isDirectory()
) {
throw new Error('Invalid build directory');
throw new Error('Invalid build directory:' + workDirectory);
}

if (!fs.existsSync(buildDir + '/jodit' + (argv.min ? '.min' : '') + '.js')) {
Expand Down
9 changes: 3 additions & 6 deletions tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"extends": "ts-node/node16/tsconfig.json",
"extends": "ts-node/node16/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"resolveJsonModule": true,
"verbatimModuleSyntax": false,
"allowSyntheticDefaultImports": true
}
"target": "es5"
}
}

0 comments on commit 4539bb9

Please sign in to comment.