bem-site / bem-forum-content-ru

Content BEM forum for Russian speak users
MIT License
56 stars 6 forks source link

После обновления на bem-core v3 сломались спеки #1012

Closed kompolom closed 8 years ago

kompolom commented 8 years ago

Error: Seems like you have no base templates from i-bem.bemhtml

Подскажите куда копать?

apsavin commented 8 years ago

Обновить версию bem-xjst?

tadatuta commented 8 years ago

@kompolom, вот пример конфига, обрати внимание на секцию templateEngine и scripts.

specs.configure({
        destPath: 'desktop.specs',
        levels: ['common.blocks'],
        sourceLevels: levels.concat('libs/bem-pr/spec.blocks'),
        jsSuffixes: ['vanilla.js', 'browser.js', 'js'],
        depsTech: require('enb-bem-techs').deps,
        langs: true,
        scripts: ['https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js'],
        templateEngine: {
            templateTech: require('enb-bemxjst/techs/bemhtml'),
            templateOptions: { sourceSuffixes: ['bemhtml', 'bemhtml.js'] },
            htmlTech: require('enb-bemxjst/techs/bemjson-to-html'),
            htmlTechOptionNames: { bemjsonFile: 'bemjsonFile', templateFile: 'bemhtmlFile' }
        }
belozer commented 8 years ago

Что-то не пойму. Такая же проблема возникает при обновлении на bem-components@v5 и bem-core@v4. Пробовал в сборку добавить

        scripts: ['https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js'],
        templateEngine: {
            templateTech: require('enb-bemxjst/techs/bemhtml'),
            templateOptions: { sourceSuffixes: ['bemhtml', 'bemhtml.js'] },
            htmlTech: require('enb-bemxjst/techs/bemjson-to-html'),
            htmlTechOptionNames: { bemjsonFile: 'bemjsonFile', templateFile: 'bemhtmlFile' }
        }

таже ошибка...

tadatuta commented 8 years ago

необходимо добавить engineOptions : { elemJsInstances : true }, т.к. начиная с bem-core v4 появилась поддержка JS у элементов.

belozer commented 8 years ago

@tadatuta сейчас такой конфиг

    config.module('enb-bem-specs').createConfigurator('specs').configure({
        destPath       : 'common.specs',
        levels         : [].concat(project),
        sourceLevels   : [].concat(specs, libs, project),
        jsSuffixes     : ['vanilla.js', 'browser.js', 'js'],
        depsTech       : techs.bem.depsOld,
        scripts        : ['https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js'],
        templateEngine : {
            bemtreeTemplateTech : require('enb-bemxjst/techs/bemtree'),
            templateTech        : require('enb-bemxjst/techs/bemhtml'),
            templateOptions : {
                sourceSuffixes : ['bemhtml', 'bemhtml.js'],
                engineOptions  : { elemJsInstances : true }
            },
            htmlTech : require('enb-bemxjst/techs/bemjson-to-html'),
            htmlTechOptionNames : { bemjsonFile : 'bemjsonFile', templateFile : 'bemhtmlFile' }
        }
    });

выпадает ошибка

...
15:00:09.370 - [failed] [common.specs/validation_card/validation_card.spec.js] borschik
15:00:09.371 - [failed] [common.specs/validation_length/validation_length.spec.js] borschik
15:00:09.372 - [failed] [common.specs/validation_numbers/validation_numbers.html] bemjson-to-html
15:00:09.372 - [failed] [common.specs/validation/validation.html] bemjson-to-html
15:00:09.372 - [failed] [common.specs/validation_required/validation_required.spec.js] borschik
15:00:09.372 - [failed] [common.specs/validation_email/validation_email.browser.template.js] bemhtml
15:00:09.372 - [failed] [common.specs/validation_money/validation_money.browser.template.js] bemhtml
15:00:09.373 - [failed] [common.specs/validation_numbers/validation_numbers.pre.spec.js] file-merge
15:00:09.373 - [failed] [common.specs/validation/validation.pre.spec.js] file-merge
15:00:09.373 - [failed] [common.specs/validation_pattern/validation_pattern.pre.spec.js] file-merge
15:00:09.374 - build failed
SyntaxError: Unexpected identifier
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at doRequire (/home/sergey/projects/bem-forms/node_modules/enb-async-require/lib/async-require.js:23:30)
    at /home/sergey/projects/bem-forms/node_modules/enb-async-require/lib/async-require.js:35:9
    at Object.Promise (/home/sergey/projects/bem-forms/node_modules/vow/lib/vow.js:308:9)
belozer commented 8 years ago

Убрал sourceSuffixes : ['bemhtml', 'bemhtml.js'], собралось. Но теперь другая проблема Failed to start mocha: Init timeout на всех тестах

tadatuta commented 8 years ago

@belozyorcev правильный конфиг для bem-core v4 можно посмотреть в https://github.com/bem/bem-components/commit/f427fc39fb8e3ad4cc56e417c794f3d1d4dcb3fd Он совершенно точно работает.

belozer commented 8 years ago

@tadatuta вроде завелоь.

Сейчас правда борюсь с Error: Module "spec": can't resolve dependence "i-bem-dom"

вроде что-то нашёл https://github.com/bem/bem-components/issues/1565