| 15 | } |
| 16 | |
| 17 | loadVocabulary(vocabularyFile) { |
| 18 | if (!vocabularyFile) return |
| 19 | |
| 20 | let filePath; |
| 21 | if (path.isAbsolute(vocabularyFile)) { |
| 22 | filePath = vocabularyFile; |
| 23 | } else { |
| 24 | filePath = path.join(store.codeceptDir, vocabularyFile); |
| 25 | } |
| 26 | |
| 27 | try { |
| 28 | const require = createRequire(import.meta.url) |
| 29 | const vocabulary = require(filePath) |
| 30 | this.vocabulary = merge(this.vocabulary, vocabulary) |
| 31 | } catch (err) { |
| 32 | throw new Error(`Can't load vocabulary from ${filePath}; ${err}`) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | value(val) { |
| 37 | return this.vocabulary[val] |