Skip to content

Commit

Permalink
fix: Fix tests
Browse files Browse the repository at this point in the history
From fork codermarcos/interpret
On branch master
Changes to be committed:
	modified:   test/fixtures/swc.js/0/package.json
	new file:   test/fixtures/swc.js/1/package.json
	new file:   test/fixtures/swc.js/1/test.swc.js
	modified:   test/fixtures/swc.jsx/0/package.json
	new file:   test/fixtures/swc.jsx/1/package.json
	new file:   test/fixtures/swc.jsx/1/test.swc.jsx
	modified:   test/fixtures/swc.ts/0/package.json
	new file:   test/fixtures/swc.ts/1/package.json
	new file:   test/fixtures/swc.ts/1/test.swc.ts
	modified:   test/fixtures/swc.tsx/0/package.json
	new file:   test/fixtures/swc.tsx/1/package.json
	new file:   test/fixtures/swc.tsx/1/test.swc.tsx
	modified:   test/fixtures/ts/4/package.json
	new file:   test/fixtures/ts/5/package.json
	new file:   test/fixtures/ts/5/test.ts
	modified:   test/fixtures/tsx/4/package.json
	new file:   test/fixtures/tsx/5/package.json
	new file:   test/fixtures/tsx/5/test.tsx
	modified:   test/index.js
  • Loading branch information
codermarcos committed Mar 28, 2024
1 parent 5c551c7 commit 94097d2
Show file tree
Hide file tree
Showing 19 changed files with 150 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/swc.js/0/package.json
@@ -1,6 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
"@swc-node/register": "^1.9.0"
}
}
6 changes: 6 additions & 0 deletions test/fixtures/swc.js/1/package.json
@@ -0,0 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
}
}
14 changes: 14 additions & 0 deletions test/fixtures/swc.js/1/test.swc.js
@@ -0,0 +1,14 @@
class Foo {
#x = 1;
#y = 2;
}

export default {
data: {
trueKey: true,
falseKey: false,
subKey: {
subProp: 1,
},
},
};
2 changes: 1 addition & 1 deletion test/fixtures/swc.jsx/0/package.json
@@ -1,6 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
"@swc-node/register": "^1.9.0"
}
}
6 changes: 6 additions & 0 deletions test/fixtures/swc.jsx/1/package.json
@@ -0,0 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
}
}
28 changes: 28 additions & 0 deletions test/fixtures/swc.jsx/1/test.swc.jsx
@@ -0,0 +1,28 @@
const React = {
createElement(Component) {
return Component();
},
};

class Foo {
#x = 1;
#y = 2;
}

function Bar() {
const foo = new Foo();

return foo;
}

const a = <Bar />;

export default {
data: {
trueKey: true,
falseKey: false,
subKey: {
subProp: 1,
},
},
};
2 changes: 1 addition & 1 deletion test/fixtures/swc.ts/0/package.json
@@ -1,6 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
"@swc-node/register": "^1.9.0"
}
}
6 changes: 6 additions & 0 deletions test/fixtures/swc.ts/1/package.json
@@ -0,0 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
}
}
14 changes: 14 additions & 0 deletions test/fixtures/swc.ts/1/test.swc.ts
@@ -0,0 +1,14 @@
class Foo {
#x: number = 1;
#y: number = 2;
}

export default {
data: {
trueKey: true as boolean,
falseKey: false as boolean,
subKey: {
subProp: 1,
},
},
} as const;
2 changes: 1 addition & 1 deletion test/fixtures/swc.tsx/0/package.json
@@ -1,6 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
"@swc-node/register": "^1.9.0"
}
}
6 changes: 6 additions & 0 deletions test/fixtures/swc.tsx/1/package.json
@@ -0,0 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
}
}
18 changes: 18 additions & 0 deletions test/fixtures/swc.tsx/1/test.swc.tsx
@@ -0,0 +1,18 @@
const React = {
createElement(Component: () => any) {
return Component();
},
};

// Test harmony arrow functions.
const Component = () => {
var trueKey: boolean = true;
var falseKey: boolean = false;
var subKey = { subProp: 1 };

// Test harmony object short notation.
return { data: { trueKey, falseKey, subKey } };
};

// Test TSX syntax.
export default <Component />;
2 changes: 1 addition & 1 deletion test/fixtures/ts/4/package.json
@@ -1,6 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
"@swc-node/register": "^1.9.0"
}
}
6 changes: 6 additions & 0 deletions test/fixtures/ts/5/package.json
@@ -0,0 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
}
}
15 changes: 15 additions & 0 deletions test/fixtures/ts/5/test.ts
@@ -0,0 +1,15 @@
var test = {
data: {
trueKey: true,
falseKey: false,
subKey: {
subProp: 1,
},
},
};

var main = {
default: test,
};

export = main;
2 changes: 1 addition & 1 deletion test/fixtures/tsx/4/package.json
@@ -1,6 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
"@swc-node/register": "^1.9.0"
}
}
6 changes: 6 additions & 0 deletions test/fixtures/tsx/5/package.json
@@ -0,0 +1,6 @@
{
"dependencies": {
"@swc/core": "^1.2.110",
"@swc/register": "^0.1.7"
}
}
18 changes: 18 additions & 0 deletions test/fixtures/tsx/5/test.tsx
@@ -0,0 +1,18 @@
const React = {
createElement(Component: () => any) {
return Component();
},
};

// Test harmony arrow functions.
const Component = () => {
var trueKey: boolean = true;
var falseKey: boolean = false;
var subKey = { subProp: 1 };

// Test harmony object short notation.
return { data: { trueKey, falseKey, subKey } };
};

// Test TSX syntax.
export default <Component />;
2 changes: 1 addition & 1 deletion test/index.js
Expand Up @@ -131,7 +131,7 @@ describe('interpret.extensions', function () {
}

// Skip any swc test on linux due to https://github.com/swc-project/swc/issues/4107
if (name === '@swc/register' && process.platform === 'linux') {
if ((name === '@swc/register' || '@swc-node/register') && process.platform === 'linux') {
this.skip();
}

Expand Down

0 comments on commit 94097d2

Please sign in to comment.