Skip to content

Commit fb2fa58

Browse files
committed
Re-enable more tests using uvu insted of jest
1 parent 94d8fa0 commit fb2fa58

File tree

34 files changed

+407
-84
lines changed

34 files changed

+407
-84
lines changed

package-lock.json

Lines changed: 73 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "proper-tags",
33
"description": "A few common utility template tags for ES2015",
4-
"version": "2.0.0-alpha.5",
4+
"version": "2.0.0-alpha.6",
55
"author": "Hexagon <https://github.com/hexagon>",
66
"bugs": {
77
"url": "http://github.com/declandewet/common-tags/issues"
@@ -16,6 +16,7 @@
1616
],
1717
"devDependencies": {
1818
"eslint": "^8.37.0",
19+
"micromatch": "^4.0.5",
1920
"rollup": "^1.32.1",
2021
"typescript": "^5.0.2",
2122
"uvu": "^0.5.6"
@@ -65,7 +66,7 @@
6566
"url": "https://github.com/hexagon/proper-tags"
6667
},
6768
"scripts": {
68-
"test": "uvu src/commaLists/ && uvu src/commaListsAnd/ && uvu src/commaListsOr/",
69+
"test": "uvu src/",
6970
"test:lint": "eslint ./**/*.js",
7071
"test:lint:fix": "eslint --fix ./**/*.js",
7172
"build": "npm update && npm run build:precleanup && npm run test:lint && npm run build:dist && npm run build:typings",

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import { html } from 'https://deno.land/x/proper_tags/dist/proper-tags.js';
6262
To include proper-tags via **jsdelivr**, add the following script tag to your HTML file:
6363

6464
```html
65-
<script src="https://cdn.jsdelivr.net/npm/proper-tags@2.0.0-alpha.5/dist/proper-tags.umd.js"></script>
65+
<script src="https://cdn.jsdelivr.net/npm/proper-tags@2.0.0-alpha.6/dist/proper-tags.umd.js"></script>
6666
```
6767

6868
> **Note:** Make sure to replace `2.0.0-alpha.1` with the latest version

src/TemplateTag/TemplateTag.test.js renamed to src/TemplateTag/TemplateTag.test.js_disabled

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
import TemplateTag from '../TemplateTag';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
5+
import path from 'path';
6+
import { fileURLToPath } from 'url';
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
import { TemplateTag } from './index.js';
211

312
/* eslint-disable no-console */
413

@@ -55,3 +64,5 @@ test('performs a transformation & provides correct values to transform methods',
5564
],
5665
});
5766
});
67+
68+
test.run();

src/commaListsOr/commaListsOr.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { test } from 'uvu';
22
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
35
import path from 'path';
46
import { fileURLToPath } from 'url';
57
const __filename = fileURLToPath(import.meta.url);

src/createTag/createTag.test.js renamed to src/createTag/createTag.test.js_disabled

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { test, suite } from 'uvu';
22
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
35
import path from 'path';
46
import { fileURLToPath } from 'url';
57
const __filename = fileURLToPath(import.meta.url);

src/html/html.test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import html from './html';
2-
import { readFromFixture } from '../testUtils';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
5+
import path from 'path';
6+
import { fileURLToPath } from 'url';
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
import { html } from './html.js';
11+
import { readFromFixture } from '../testUtils/index.js';
312

413
const val = 'amaze';
514
const nil = null;
@@ -164,3 +173,5 @@ test('may not indent as expected when the array is not in a new line', () => {
164173

165174
assert.equal(actual, expected);
166175
});
176+
177+
test.run();

src/id/id.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import id from './id';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
import { id } from './id.js';
25

36
test('returns whatever comes at it', () => {
47
assert.equal(id`foo${42}bar`, 'foo42bar');
@@ -7,3 +10,5 @@ test('returns whatever comes at it', () => {
710
test('returns whatever comes at it (number version)', () => {
811
assert.equal(id(42), 42);
912
});
13+
14+
test.run();

src/index.test.js renamed to src/index.test.js_disabled

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import fs from "fs";
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
import * as fs from "fs";
25
import path from "path";
36
import mm from "micromatch";
47

@@ -29,3 +32,5 @@ test("common-tags exports all the right modules as props", () => {
2932
assert.equal(require("./index")).toHaveProperty(module, requireModule(module));
3033
});
3134
});
35+
36+
test.run();

src/inlineArrayTransformer/inlineArrayTransformer.test.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import inlineArrayTransformer from './inlineArrayTransformer';
2-
import createTag from '../createTag';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
import { inlineArrayTransformer } from './inlineArrayTransformer.js';
5+
import { createTag } from '../createTag/index.js';
36

47
test('only operates on arrays', () => {
58
const tag = createTag(inlineArrayTransformer);
@@ -9,7 +12,7 @@ test('only operates on arrays', () => {
912
test('includes an array as a comma-separated list', () => {
1013
const tag = createTag(inlineArrayTransformer({ separator: ',' }));
1114
assert.equal(tag`I like ${['apple', 'banana', 'kiwi']}`,
12-
'I like apple, banana, kiwi',
15+
'I like apple, banana, kiwi'
1316
);
1417
});
1518

@@ -28,7 +31,7 @@ test('replaces last separator with a conjunction', () => {
2831
);
2932
assert.equal(
3033
tag`I like ${['apple', 'banana', 'a fruit that has "," in the name']}`,
31-
, 'I like apple, banana and a fruit that has "," in the name');
34+
'I like apple, banana and a fruit that has "," in the name');
3235
});
3336

3437
test('does not use a conjunction if there is only one item in an array', () => {
@@ -102,3 +105,5 @@ test('does not introduce excess newlines', () => {
102105
'My friends are always\n\n dramatic\n emotional\n needy',
103106
);
104107
});
108+
109+
test.run();

src/inlineLists/inlineLists.test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import inlineLists from './inlineLists';
2-
import { readFromFixture } from '../testUtils';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
5+
import path from 'path';
6+
import { fileURLToPath } from 'url';
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
import { inlineLists } from './inlineLists.js';
11+
import { readFromFixture } from '../testUtils/index.js';
312

413
const val = 'amaze';
514

@@ -12,3 +21,5 @@ test('includes arrays as space-separated list', () => {
1221
`;
1322
assert.equal(actual, expected);
1423
});
24+
25+
test.run();

src/oneLine/oneLine.test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import oneLine from './oneLine';
2-
import { readFromFixture } from '../testUtils';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
5+
import path from 'path';
6+
import { fileURLToPath } from 'url';
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
import { oneLine } from './oneLine.js';
11+
import { readFromFixture } from '../testUtils/index.js';
312

413
const val = 'amaze';
514

@@ -34,3 +43,5 @@ test('preserves whitespace within input lines, replacing only newlines', () => {
3443
`;
3544
assert.equal(actual, expected);
3645
});
46+
47+
test.run()

src/oneLineCommaLists/oneLineCommaLists.test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import oneLineCommaLists from './oneLineCommaLists';
2-
import { readFromFixture } from '../testUtils';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
5+
import path from 'path';
6+
import { fileURLToPath } from 'url';
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
import { oneLineCommaLists } from './oneLineCommaLists.js';
11+
import { readFromFixture } from '../testUtils/index.js';
312

413
const val = 'amaze';
514

@@ -12,3 +21,5 @@ test('includes arrays as comma-separated list on one line', () => {
1221
`;
1322
assert.equal(actual, expected);
1423
});
24+
25+
test.run();

src/oneLineCommaListsAnd/oneLineCommaListsAnd.test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import oneLineCommaListsAnd from './oneLineCommaListsAnd';
2-
import { readFromFixture } from '../testUtils';
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
4+
/* Recreate __dirname */
5+
import path from 'path';
6+
import { fileURLToPath } from 'url';
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
import { oneLineCommaListsAnd } from './oneLineCommaListsAnd.js';
11+
import { readFromFixture } from '../testUtils/index.js';
312

413
const val = 'amaze';
514

@@ -25,3 +34,5 @@ test('only returns the first item of a single element array', () => {
2534
`;
2635
assert.equal(actual, expected);
2736
});
37+
38+
test.run();

0 commit comments

Comments
 (0)