File: test.js.md

package info (click to toggle)
node-rollup-plugin-inject 5.0.2~ds1%2B~3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 516 kB
  • sloc: javascript: 1,247; makefile: 7
file content (182 lines) | stat: -rw-r--r-- 3,232 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Snapshot report for `test/test.js`

The actual snapshot is saved in `test.js.snap`.

Generated by [AVA](https://avajs.dev).

## inserts a default import statement

> Snapshot 1

    `import { default as $ } from 'jquery';␊
    $(() => {␊
      console.log('ready');␊
    });␊
    `

## uses the modules property

> Snapshot 1

    `import { default as $ } from 'jquery';␊
    $(() => {␊
      console.log('ready');␊
    });␊
    `

## escapes apostrophes in module name

> Snapshot 1

    `import { default as $ } from 'd\\'oh';␊
    $(() => {␊
      console.log('ready');␊
    });␊
    `

## escapes backslashes in module name

> Snapshot 1

    `import { default as $ } from 'slash\\\\back';␊
    $(() => {␊
      console.log('ready');␊
    });␊
    `

## inserts a named import statement

> Snapshot 1

    `import { Promise as Promise } from 'es6-promise';␊
    Promise.all([thisThing, thatThing]).then(() => someOtherThing);␊
    `

## overwrites keypaths

> Snapshot 1

    `import { default as $inject_Object_assign } from 'fixtures/keypaths/polyfills/object-assign.js';␊
    const original = { foo: 'bar' };␊
    const clone = $inject_Object_assign({}, original);␊
    export default clone;␊
    `

## ignores existing imports

> Snapshot 1

    `import $ from 'jquery';␊
    $(() => {␊
      console.log('ready');␊
    });␊
    `

## handles shadowed variables

> Snapshot 1

    `function launch($) {␊
      $(() => {␊
        console.log('ready');␊
      });␊
    }␊
    launch((fn) => fn());␊
    `

## handles shorthand properties

> Snapshot 1

    `import { Promise as Promise } from 'es6-promise';␊
    const polyfills = { Promise };␊
    polyfills.Promise.resolve().then(() => 'it works');␊
    `

## handles shorthand properties (as assignment)

> Snapshot 1

    `const { Promise = "fallback" } = foo;␊
    console.log(Promise);␊
    `

## handles shorthand properties in function

> Snapshot 1

    `function foo({Promise}) {␊
      console.log(Promise);␊
    }␊
    foo();␊
    `

## handles shorthand properties in function (as fallback value)

> Snapshot 1

    `import { Promise as Promise } from 'es6-promise';␊
    function foo({bar = Promise}) {␊
      console.log(bar);␊
    }␊
    foo();␊
    `

## handles redundant keys

> Snapshot 1

    `import { default as $inject_Buffer_isBuffer } from 'is-buffer';␊
    $inject_Buffer_isBuffer('foo');␊
    `

## generates * imports

> Snapshot 1

    `import * as foo from 'foo';␊
    console.log(foo.bar);␊
    console.log(foo.baz);␊
    `

## transpiles non-JS files but handles failures to parse

> Snapshot 1

    `import './styles.css';␊
    import foo from './foo.es6';␊
    assert.equal(foo, path.join('..', 'baz'));␊
    `

## ignores check isReference is false

> Snapshot 1

    `import { bar as foo } from 'path';␊
    console.log({ bar: foo });␊
    class Foo {␊
      bar() {␊
        console.log(this);␊
      }␊
    }␊
    export { Foo };␊
    export { foo as bar };␊
    `