| 1 |
import { fileURLToPath } from "url"; |
| 2 |
import path from "path"; |
| 3 |
|
| 4 |
import _getTargets from "../../lib/index.js"; |
| 5 |
const getTargets = _getTargets.default || _getTargets; |
| 6 |
|
| 7 |
const oldCwd = process.cwd(); |
| 8 |
|
| 9 |
beforeAll(() => { |
| 10 |
process.chdir(path.dirname(fileURLToPath(import.meta.url))); |
| 11 |
}); |
| 12 |
|
| 13 |
afterAll(() => { |
| 14 |
process.chdir(oldCwd); |
| 15 |
}); |
| 16 |
|
| 17 |
it("loads browserslistrc", () => { |
| 18 |
const actual = getTargets({}, {}); |
| 19 |
|
| 20 |
expect(actual).toEqual({ chrome: "4.0.0" }); |
| 21 |
}); |
| 22 |
|
| 23 |
it("loads browserslistrc and respects browserslistEnv", () => { |
| 24 |
const actual = getTargets( |
| 25 |
{}, |
| 26 |
{ |
| 27 |
browserslistEnv: "development", |
| 28 |
}, |
| 29 |
); |
| 30 |
|
| 31 |
expect(actual).toEqual({ chrome: "88.0.0" }); |
| 32 |
}); |