track-cli 4.1.0-rc4 → 4.2.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/src/action/add.js +6 -1
- package/esm/src/action/run.js +1 -2
- package/esm/src/meta.d.ts +1 -1
- package/esm/src/meta.js +1 -1
- package/esm/src/orca/types.d.ts +1 -0
- package/esm/src/shared/errors.d.ts +4 -0
- package/esm/src/shared/errors.js +12 -0
- package/package.json +1 -1
package/esm/src/action/add.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
2
|
import { CONFIG_FILE_PATH, load as loadConfig } from "../shared/config.js";
|
|
3
|
-
import { CantReadFile, NewFilesNotAllowed } from "../shared/errors.js";
|
|
3
|
+
import { CantReadFile, NewFilesNotAllowed, RejectNewFilesInTestFolder } from "../shared/errors.js";
|
|
4
4
|
import { pathsToFilenameSet, toNativeStyle } from "../shared/file.js";
|
|
5
5
|
import { getCommonChallengeContext, listFileNames, printWorkingFileSet, trackClientFromConfig, } from "../shared/mod.js";
|
|
6
6
|
import { FileListType } from "../shared/types.js";
|
|
@@ -20,6 +20,11 @@ export async function add(filePaths) {
|
|
|
20
20
|
// Don't allow the config file to be added
|
|
21
21
|
existingPaths.add(CONFIG_FILE_PATH);
|
|
22
22
|
const pathsToAdd = Array.from(requestedPaths).filter((p) => !existingPaths.has(p));
|
|
23
|
+
// Files in test folder are not allowed
|
|
24
|
+
const invalidFiles = pathsToAdd.filter(v => v.startsWith("test/"));
|
|
25
|
+
if (invalidFiles.length > 0) {
|
|
26
|
+
throw new RejectNewFilesInTestFolder(invalidFiles);
|
|
27
|
+
}
|
|
23
28
|
const addedFiles = listFileNames(codingContext, FileListType.UserAddedFiles)
|
|
24
29
|
.concat(pathsToAdd);
|
|
25
30
|
const updatedFiles = {};
|
package/esm/src/action/run.js
CHANGED
|
@@ -8,7 +8,6 @@ import { EnvSettings, FileListType, } from "../shared/types.js";
|
|
|
8
8
|
import * as colors from "../../deps/deno.land/std@0.195.0/fmt/colors.js";
|
|
9
9
|
import { exists } from "../../deps/deno.land/std@0.195.0/fs/mod.js";
|
|
10
10
|
import { FileNotFound } from "../shared/errors.js";
|
|
11
|
-
const MAX_MEMORY_FOR_TEST = 512 * 1024 * 1024; // 512 MB
|
|
12
11
|
export async function run(options) {
|
|
13
12
|
const config = await loadConfig();
|
|
14
13
|
const api = trackClientFromConfig(config);
|
|
@@ -26,6 +25,7 @@ export async function run(options) {
|
|
|
26
25
|
cacheDirs: envConfig.cacheDirs,
|
|
27
26
|
username: envConfig.username,
|
|
28
27
|
baseDir: envConfig.baseDir,
|
|
28
|
+
keepContainer: true,
|
|
29
29
|
});
|
|
30
30
|
const envVars = Object.assign({}, envConfig.variables);
|
|
31
31
|
envVars["CHALLENGE_LANGUAGE"] = codingContext.challengeLanguage;
|
|
@@ -91,7 +91,6 @@ export async function run(options) {
|
|
|
91
91
|
files: buildRan ? [] : files,
|
|
92
92
|
envVars: {},
|
|
93
93
|
tarballUrls: buildRan ? [] : codingContext.tarballUrls,
|
|
94
|
-
memoryBytes: MAX_MEMORY_FOR_TEST,
|
|
95
94
|
};
|
|
96
95
|
const scoreCounter = new CountPassingLineHandler();
|
|
97
96
|
const runDoneData = await orca.simpleRunCommand(runCmd, scoreCounter);
|
package/esm/src/meta.d.ts
CHANGED
package/esm/src/meta.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as colors from "../deps/deno.land/std@0.195.0/fmt/colors.js";
|
|
2
2
|
// @ts-ignore: has no exported member
|
|
3
3
|
import { CookieJar, fetch } from "node-fetch-cookies";
|
|
4
|
-
export const VERSION = "4.
|
|
4
|
+
export const VERSION = "4.2.0-rc1";
|
|
5
5
|
export const DESCRIPTION = "A CLI for interacting with tracks.run and running code tests on track's servers";
|
|
6
6
|
const VERSION_RE = /^(\d+)\.(\d+)\.(\d+)(?:-?(.*))$/;
|
|
7
7
|
function parseSemver(s) {
|
package/esm/src/orca/types.d.ts
CHANGED
|
@@ -79,6 +79,10 @@ export declare class FileMissingOrOutsideDirectory extends TrackError {
|
|
|
79
79
|
export declare class NewFilesNotAllowed extends TrackError {
|
|
80
80
|
constructor();
|
|
81
81
|
}
|
|
82
|
+
export declare class RejectNewFilesInTestFolder extends TrackError {
|
|
83
|
+
fileNames: string[];
|
|
84
|
+
constructor(fileNames: string[]);
|
|
85
|
+
}
|
|
82
86
|
export declare class DeleteFilesNotAllowed extends TrackError {
|
|
83
87
|
constructor();
|
|
84
88
|
}
|
package/esm/src/shared/errors.js
CHANGED
|
@@ -222,6 +222,18 @@ export class NewFilesNotAllowed extends TrackError {
|
|
|
222
222
|
this.name = "NewFilesNotAllowed";
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
+
export class RejectNewFilesInTestFolder extends TrackError {
|
|
226
|
+
constructor(fileNames) {
|
|
227
|
+
super(`New files under test folder are not allowed: ${fileNames.join(", ")}`);
|
|
228
|
+
Object.defineProperty(this, "fileNames", {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
configurable: true,
|
|
231
|
+
writable: true,
|
|
232
|
+
value: fileNames
|
|
233
|
+
});
|
|
234
|
+
this.name = "RejectNewFilesInTestFolder";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
225
237
|
export class DeleteFilesNotAllowed extends TrackError {
|
|
226
238
|
constructor() {
|
|
227
239
|
super("This challenge does not allow the deletion of files");
|