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

refactor(test): move regress to /issues folder #186

Merged
merged 1 commit into from
Dec 18, 2023
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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,10 @@ import { test } from "node:test";
import assert from "node:assert";

// Import Internal Dependencies
import { runASTAnalysis } from "../index.js";
import { runASTAnalysis } from "../../index.js";

// CONSTANTS
const FIXTURE_URL = new URL("fixtures/regress/", import.meta.url);

// Regression test for https://github.com/NodeSecure/js-x-ray/issues/59
test("it should not crash for prop-types", () => {
const propTypes = readFileSync(
new URL("prop-types.min.js", FIXTURE_URL),
"utf-8"
);
runASTAnalysis(propTypes);
});

test("it should not crash for JSX", () => {
const propTypes = readFileSync(
new URL("jsx.js", FIXTURE_URL),
"utf-8"
);
runASTAnalysis(propTypes);
});
const FIXTURE_URL = new URL("../fixtures/issues/", import.meta.url);

// Regression test for https://github.com/NodeSecure/js-x-ray/issues/109
test("it should not crash for a JavaScript file containing HTML comments (and removeHTMLComments option enabled)", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test } from "node:test";
import assert from "node:assert";

// Import Internal Dependencies
import { runASTAnalysis } from "../index.js";
import { runASTAnalysis } from "../../index.js";

/**
* @see https://github.com/NodeSecure/js-x-ray/issues/163
Expand Down
27 changes: 27 additions & 0 deletions test/issues/59-undefined-depName.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Import Node.js Dependencies
import { readFileSync } from "node:fs";
import { test } from "node:test";
import assert from "node:assert";

// Import Internal Dependencies
import { runASTAnalysis } from "../../index.js";

// CONSTANTS
const FIXTURE_URL = new URL("../fixtures/issues/", import.meta.url);

// Regression test for https://github.com/NodeSecure/js-x-ray/issues/59
test("it should not crash for prop-types", () => {
const propTypes = readFileSync(
new URL("prop-types.min.js", FIXTURE_URL),
"utf-8"
);
runASTAnalysis(propTypes);
});

test("it should not crash for JSX", () => {
const propTypes = readFileSync(
new URL("jsx.js", FIXTURE_URL),
"utf-8"
);
runASTAnalysis(propTypes);
});
Loading