当我将 Jest 与 Antd、React 和 Parcel 结合使用时,出现以下错误。Jest 抱怨 Antd css 文件。Jest 是否应该默认包含 node_modules ?如果不是,是否可以排除它?
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not > plain JavaScript.
{ProjectPath}/node_modules/antd/lib/style/index.css:5
.ant-modal,
^
SyntaxError: Unexpected token '.'
8 |
9 |
> 10 | export default () => {
Run Code Online (Sandbox Code Playgroud)
笑话配置.js
{
"jest": {
"setupFilesAfterEnv": [
"<rootDir>src/setupTests.js"
],
"transform": {
"^.+\\.js$": "babel-jest",
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
}
}
}
Run Code Online (Sandbox Code Playgroud)
.babelrc
{
"presets": [ …Run Code Online (Sandbox Code Playgroud) 我知道在单击后如何隐藏“提交”按钮方面有很多答案,但是我无法使用任何解决方案。我试图用onclick=""和javascript 隐藏它。该表格适用于wordpress插件。
echo '<p><input type="submit" name="submitted" id="send" value="Send"></p>';
Run Code Online (Sandbox Code Playgroud) 尝试在我的模型之一中删除两列并添加新列(删除和新建之间没有关系),但生成的迁移会重命名已删除的列之一。由于删除的列保存生产中的数据,因此必须删除它们而不是重命名它们。
有没有办法解决这个问题,以便生成的迁移删除并创建而不是重命名?
模型中的变量:
public DateTime? PublishedAt { get; private set; }
public bool? IsValidated { get; private set; }
public States? States { get; private set; } // Added
public Invites? Invites { get; private set; } // Removed
public string Info { get; private set; } // Removed
Run Code Online (Sandbox Code Playgroud)
生成的迁移:
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Info",
table: "Articles");
migrationBuilder.RenameColumn(
name: "Invites",
table: "Articles",
newName: "States");
}
Run Code Online (Sandbox Code Playgroud) 即使有这样的多个问题,我也无法通过分组返回具有最近日期的行.
我有下表..
| message_id | from | to | created_at | status
----------------------------------------------
| 1 | 1 | 2 | 2017-04-06 | 1
| 2 | 1 | 2 | 2017-04-07 | 0
| 3 | 3 | 4 | 2017-04-06 | 1
| 4 | 3 | 4 | 2017-04-07 | 0
----------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我试着获取最近日期的行.
| message_id | from | to | created_at | status
----------------------------------------------
| 2 | 1 | 2 | 2017-04-07 | 0
| 4 | 3 …Run Code Online (Sandbox Code Playgroud)