-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathtransform.js
40 lines (35 loc) · 1.02 KB
/
transform.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import test from 'ava'
import compiler from './helpers/compiler'
test('use translations', async t => {
const { compile, mfs } = compiler({
entry: './fixtures/basic/page.mina',
output: {
filename: 'fixtures/basic/page.js',
},
module: {
rules: [
{
test: /\.mina$/,
use: {
loader: require.resolve('..'),
options: {
transform: require('./helpers/transform/scope-id'),
},
},
},
],
},
})
const stats = await compile()
t.deepEqual(stats.compilation.errors, [], stats.compilation.errors[0])
t.true(mfs.existsSync('/assets/logo.72c9db.png'))
t.true(
mfs
.readFileSync('/fixtures/basic/page.js', 'utf8')
.includes('module.exports = "a2fce32d"')
)
t.is(mfs.readFileSync('/fixtures/basic/page.wxml', 'utf8'), 'a2fce32d')
t.is(mfs.readFileSync('/fixtures/basic/page.wxss', 'utf8'), 'a2fce32d')
t.is(mfs.readFileSync('/fixtures/basic/page.json', 'utf8'), 'a2fce32d')
t.pass()
})