Skip to content

Commit fcf925d

Browse files
committed
test: add YAML and TOML tests
1 parent 2aa95c1 commit fcf925d

File tree

21 files changed

+260
-100
lines changed

21 files changed

+260
-100
lines changed

pnpm-lock.yaml

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

tests/integration/asset/__snapshots__/index.test.ts.snap

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,72 @@ export { __webpack_exports__bar as bar, __webpack_exports__foo as foo };
3232
"
3333
`;
3434

35+
exports[`use json/yaml/toml 1`] = `
36+
"var json_example_namespaceObject = JSON.parse('{"u":"foo","e":[1,2]}');
37+
const toml_example = {
38+
hello: "world",
39+
foo: {
40+
bar: "baz"
41+
}
42+
};
43+
const yaml_example = {
44+
hello: 'world',
45+
foo: {
46+
bar: 'baz'
47+
}
48+
};
49+
console.log(json_example_namespaceObject.u);
50+
console.log(json_example_namespaceObject.e);
51+
console.log(yaml_example.hello);
52+
console.log(yaml_example.foo);
53+
console.log(toml_example.hello);
54+
console.log(toml_example.foo);
55+
"
56+
`;
57+
58+
exports[`use json/yaml/toml 2`] = `
59+
"import * as __WEBPACK_EXTERNAL_MODULE__assets_json_example_js_f9233e35__ from "./assets/json-example.js";
60+
import * as __WEBPACK_EXTERNAL_MODULE__assets_toml_example_js_83d79853__ from "./assets/toml-example.js";
61+
import * as __WEBPACK_EXTERNAL_MODULE__assets_yaml_example_js_f81ac546__ from "./assets/yaml-example.js";
62+
console.log(__WEBPACK_EXTERNAL_MODULE__assets_json_example_js_f9233e35__.name);
63+
console.log(__WEBPACK_EXTERNAL_MODULE__assets_json_example_js_f9233e35__["default"].items);
64+
console.log(__WEBPACK_EXTERNAL_MODULE__assets_yaml_example_js_f81ac546__["default"].hello);
65+
console.log(__WEBPACK_EXTERNAL_MODULE__assets_yaml_example_js_f81ac546__["default"].foo);
66+
console.log(__WEBPACK_EXTERNAL_MODULE__assets_toml_example_js_83d79853__["default"].hello);
67+
console.log(__WEBPACK_EXTERNAL_MODULE__assets_toml_example_js_83d79853__["default"].foo);
68+
"
69+
`;
70+
71+
exports[`use json/yaml/toml 3`] = `
72+
"var json_example_rslib_entry_namespaceObject = JSON.parse('{"name":"foo","items":[1,2]}');
73+
var __webpack_exports__items = json_example_rslib_entry_namespaceObject.items;
74+
var __webpack_exports__name = json_example_rslib_entry_namespaceObject.name;
75+
export { __webpack_exports__items as items, __webpack_exports__name as name };
76+
"
77+
`;
78+
79+
exports[`use json/yaml/toml 4`] = `
80+
"const yaml_example_rslib_entry_ = {
81+
hello: 'world',
82+
foo: {
83+
bar: 'baz'
84+
}
85+
};
86+
export { yaml_example_rslib_entry_ as default };
87+
"
88+
`;
89+
90+
exports[`use json/yaml/toml 5`] = `
91+
"const toml_example_rslib_entry_ = {
92+
hello: "world",
93+
foo: {
94+
bar: "baz"
95+
}
96+
};
97+
export { toml_example_rslib_entry_ as default };
98+
"
99+
`;
100+
35101
exports[`use source.assetInclude 1`] = `
36102
"import draft_namespaceObject from "./static/assets/draft.txt";
37103
console.log(draft_namespaceObject);

tests/integration/asset/hash/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "asset-name-test",
2+
"name": "asset-hash-test",
33
"version": "1.0.0",
44
"private": true,
55
"type": "module",

0 commit comments

Comments
 (0)