Skip to content

Commit

Permalink
Clean up tests to not use 3rd party packages
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Nov 22, 2024
1 parent 207e815 commit b9ffdcb
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 134 deletions.
1 change: 0 additions & 1 deletion crates/turborepo/tests/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ fn test_trace() -> Result<(), anyhow::Error> {
"get `import_value_and_type.ts` with all dependencies" => "query { file(path: \"import_value_and_type.ts\") { path dependencies(importType: ALL) { files { items { path } } } } }",
"get `import_value_and_type.ts` with type dependencies" => "query { file(path: \"import_value_and_type.ts\") { path dependencies(importType: TYPES) { files { items { path } } } } }",
"get `import_value_and_type.ts` with value dependencies" => "query { file(path: \"import_value_and_type.ts\") { path dependencies(importType: VALUES) { files { items { path } } } } }",
"get `export_conditions` with dependencies" => "query { file(path: \"export_conditions.js\") { path dependencies(depth: 1) { files { items { path } } } } }",
"get `incorrect_extension.mjs` with dependencies" => "query { file(path: \"incorrect_extension.mjs\") { path dependencies(depth: 1) { files { items { path } } } } }",
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ expression: query_output
"files": {
"items": [
{
"path": "node_modules/swr/dist/core/index.mjs"
"path": "node_modules/swr/dist/core/index.d.mts"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ expression: query_output
"type": "Module",
"span": {
"start": 1,
"end": 173
"end": 119
},
"body": [
{
Expand Down Expand Up @@ -91,49 +91,11 @@ expression: query_output
"with": null,
"phase": "evaluation"
},
{
"type": "ImportDeclaration",
"span": {
"start": 65,
"end": 100
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"span": {
"start": 72,
"end": 78
},
"local": {
"type": "Identifier",
"span": {
"start": 72,
"end": 78
},
"ctxt": 0,
"value": "repeat",
"optional": false
}
}
],
"source": {
"type": "StringLiteral",
"span": {
"start": 84,
"end": 99
},
"value": "repeat-string",
"raw": "\"repeat-string\""
},
"typeOnly": false,
"with": null,
"phase": "evaluation"
},
{
"type": "VariableDeclaration",
"span": {
"start": 102,
"end": 130
"start": 66,
"end": 94
},
"ctxt": 0,
"kind": "const",
Expand All @@ -142,14 +104,14 @@ expression: query_output
{
"type": "VariableDeclarator",
"span": {
"start": 108,
"end": 129
"start": 72,
"end": 93
},
"id": {
"type": "Identifier",
"span": {
"start": 108,
"end": 114
"start": 72,
"end": 78
},
"ctxt": 0,
"value": "button",
Expand All @@ -159,15 +121,15 @@ expression: query_output
"init": {
"type": "NewExpression",
"span": {
"start": 117,
"end": 129
"start": 81,
"end": 93
},
"ctxt": 0,
"callee": {
"type": "Identifier",
"span": {
"start": 121,
"end": 127
"start": 85,
"end": 91
},
"ctxt": 0,
"value": "Button",
Expand All @@ -183,27 +145,27 @@ expression: query_output
{
"type": "ExpressionStatement",
"span": {
"start": 132,
"end": 148
"start": 96,
"end": 112
},
"expression": {
"type": "CallExpression",
"span": {
"start": 132,
"end": 147
"start": 96,
"end": 111
},
"ctxt": 0,
"callee": {
"type": "MemberExpression",
"span": {
"start": 132,
"end": 145
"start": 96,
"end": 109
},
"object": {
"type": "Identifier",
"span": {
"start": 132,
"end": 138
"start": 96,
"end": 102
},
"ctxt": 0,
"value": "button",
Expand All @@ -212,8 +174,8 @@ expression: query_output
"property": {
"type": "Identifier",
"span": {
"start": 139,
"end": 145
"start": 103,
"end": 109
},
"value": "render"
}
Expand All @@ -225,73 +187,21 @@ expression: query_output
{
"type": "ExpressionStatement",
"span": {
"start": 149,
"end": 166
},
"expression": {
"type": "CallExpression",
"span": {
"start": 149,
"end": 165
},
"ctxt": 0,
"callee": {
"type": "Identifier",
"span": {
"start": 149,
"end": 155
},
"ctxt": 0,
"value": "repeat",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 156,
"end": 161
},
"value": "foo",
"raw": "\"foo\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 163,
"end": 164
},
"value": 5.0,
"raw": "5"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 167,
"end": 173
"start": 113,
"end": 119
},
"expression": {
"type": "CallExpression",
"span": {
"start": 167,
"end": 172
"start": 113,
"end": 118
},
"ctxt": 0,
"callee": {
"type": "Identifier",
"span": {
"start": 167,
"end": 170
"start": 113,
"end": 116
},
"ctxt": 0,
"value": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ expression: query_output
},
{
"path": "foo.js"
},
{
"path": "node_modules/repeat-string/index.js"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ expression: query_output
},
{
"path": "foo.js"
},
{
"path": "node_modules/repeat-string/index.js"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ expression: query_output
{
"path": "packages/module-package/my-module.mjs"
},
{
"path": "packages/package-with-conditions/index.mjs"
},
{
"path": "packages/ship-types/index.ts"
},
Expand All @@ -26,6 +29,9 @@ expression: query_output
},
{
"path": "packages/utils/my-hook.ts"
},
{
"path": "packages/utils/types.ts"
}
]
},
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions turborepo-tests/integration/fixtures/turbo_trace/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Button } from "./button.tsx";
import foo from "./foo";
import repeat from "repeat-string";

const button = new Button();

button.render();
repeat("foo", 5);
foo();
4 changes: 0 additions & 4 deletions turborepo-tests/integration/fixtures/turbo_trace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"engines": {
"node": ">=18"
},
"dependencies": {
"repeat-string": "^1.6.1",
"swr": "^2.2.5"
},
"workspaces": [
"apps/*",
"packages/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ import { blackbeard } from "../../packages/another/index.jsx";
import { Pirate } from "@/types.ts";
import { walkThePlank } from "module-package";
import type { Ship } from "ship";
import type { Sword } from "utils/sword";
import { catchphrase } from "package-with-conditions";
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"dependencies": {
"utils": "*",
"@types/ship": "*"
"@types/ship": "*",
"package-with-conditions": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "Shiver me timbers, this be cjs";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const catchphrase = "Shiver me timbers, this be mjs";
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "package-with-conditions",
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.cjs"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"main": "index.ts",
"exports": {
".": "./index.ts",
"./my-hook": "./my-hook.ts"
"./my-hook": "./my-hook.ts",
"./sword": {
"types": "./types.ts"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Sword = "Saber" | "Epee" | "Foil";

0 comments on commit b9ffdcb

Please sign in to comment.