Skip to content

Commit c5a7a51

Browse files
committed
test(cli): remove temporaney resource folder
1 parent d823470 commit c5a7a51

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

packages/cli/test/configuration.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import Ajv, { ValidateFunction } from "ajv";
2020
import ConfigSchema from "../src/generated/wot-servient-schema.conf";
2121
import chaiAsPromised from "chai-as-promised";
2222
import { writeFileSync, unlinkSync } from "fs";
23-
import { join } from "path";
2423
import { ValidationError } from "ajv";
24+
import tmp from "tmp";
2525

2626
should();
2727
chaiUse(chaiAsPromised);
@@ -32,12 +32,13 @@ class ConfigurationTest {
3232
private testFilePath!: string;
3333

3434
static before() {
35+
tmp.setGracefulCleanup();
3536
const ajv = new Ajv({ strict: true, allErrors: true });
3637
ConfigurationTest.validator = ajv.compile(ConfigSchema) as ValidateFunction<Configuration>;
3738
}
3839

3940
before() {
40-
this.testFilePath = join(__dirname, "./resources", "test-config-" + Date.now() + ".json");
41+
this.testFilePath = tmp.fileSync({ postfix: ".json" }).name;
4142
}
4243

4344
after() {

packages/cli/test/executor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ class ExecutorTest {
2828
private basetTestFilePath!: string;
2929
private mockWoTContext!: WoTContext;
3030

31-
before() {
31+
static before() {
3232
tmp.setGracefulCleanup();
33+
}
34+
35+
before() {
3336
this.executor = new Executor();
3437
this.mockWoTContext = {
3538
// We are not using WoT inside this testing scripts

packages/cli/test/parsers/config-file-parser.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ import { should, expect } from "chai";
1818
import { parseConfigFile } from "../../src/parsers/config-file-parser";
1919
import { InvalidArgumentError } from "commander";
2020
import { writeFileSync, unlinkSync } from "fs";
21-
import { join } from "path";
21+
import tmp from "tmp";
2222

2323
should();
2424

2525
@suite("parseConfigFile parser")
2626
class ConfigFileParserTest {
2727
private testFilePath!: string;
2828

29+
static before() {
30+
tmp.setGracefulCleanup();
31+
}
32+
2933
before() {
30-
this.testFilePath = join(__dirname, "../resources", "test-config-" + Date.now() + ".json");
34+
this.testFilePath = tmp.fileSync({ postfix: ".json" }).name;
3135
}
3236

3337
after() {

packages/cli/test/resources/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)